Class IdentityUtil

java.lang.Object
at.qubic.api.crypto.IdentityUtil

public class IdentityUtil extends Object
  • Constructor Details

    • IdentityUtil

      public IdentityUtil(boolean doVerification, FourQ fourQ)
    • IdentityUtil

      public IdentityUtil()
  • Method Details

    • getSubSeedFromSeed

      public byte[] getSubSeedFromSeed(String seed)
    • getPrivateKeyFromSubSeed

      public byte[] getPrivateKeyFromSubSeed(byte[] subSeed)
    • getPublicKeyFromPrivateKey

      public byte[] getPublicKeyFromPrivateKey(byte[] privateKey)
    • getPublicKeyFromSeed

      public byte[] getPublicKeyFromSeed(String seed)
    • getPublicKeyFromSubSeed

      public byte[] getPublicKeyFromSubSeed(byte[] subSeed)
    • getPublicKeyFromIdentity

      public byte[] getPublicKeyFromIdentity(String identity)

      Public key is compressed version of identity. The public key is used to communicate with computors about IDs. Little endian.

      Chris D.: 32 bytes long public key can be represented by 4 big integers, 8 bytes long each (4 * 8 = 32). Last 4 chars of ID string are checksum, so we are left with 56 chars to decode. We have 4 big ints, each one fits 56 / 4 = 14 chars. Think of each big int having 26 ^ 13 + 25 possible values (has more but not interesting in this case of encoding). Each time we decode one of the 14 chars we find the character's value (by subtracting A, so that A=0, B=1,..., Z=25), we multiply previous big int value (or 0) by 26 and add to it the value of the character (char value is also the result of big int % 26 + A, when encoding).

      TL;DR => 56 characters put into four 8 byte values (positive long is good enough).

      Parameters:
      identity - The identity to convert.
      Returns:
      The public key as a byte[32] array.
    • getIdentityFromPublicKey

      public String getIdentityFromPublicKey(byte[] publicKey)
    • getTransactionHash

      public String getTransactionHash(byte[] signedTxDigest)
    • isValidSeed

      public boolean isValidSeed(String seed)
    • isValidIdentity

      public boolean isValidIdentity(String identity)