Class Ed25519KeyPair

java.lang.Object
convex.core.crypto.AKeyPair
convex.core.crypto.Ed25519KeyPair

public class Ed25519KeyPair extends AKeyPair
Class representing an Ed25519 Key Pair
  • Method Details

    • create

      public static Ed25519KeyPair create(Blob seed)
    • generate

      public static Ed25519KeyPair generate()
      Generates a new, secure random key pair. Uses a Java SecureRandom instance.
      Returns:
      New Key Pair instance.
    • create

      protected static Ed25519KeyPair create(KeyPair keyPair)
      Create a KeyPair from a JCA KeyPair
      Parameters:
      keyPair - JCA KeyPair
      Returns:
      AKeyPair instance
    • create

      public static Ed25519KeyPair create(PublicKey publicKey, PrivateKey privateKey)
      Creates an Ed25519 Key Pair with the specified keys
      Parameters:
      publicKey - Public key
      privateKey - Private key
      Returns:
      Key Pair instance
    • create

      public static Ed25519KeyPair create(AccountKey accountKey, Blob encodedPrivateKey)
      Create a key pair given a public AccountKey and a encoded Blob
      Parameters:
      accountKey - Public Key
      encodedPrivateKey - Encoded PKCS8 Private key
      Returns:
      AKeyPair instance
    • getSeed

      public Blob getSeed()
    • generate

      public static Ed25519KeyPair generate(SecureRandom random)
      Generates a secure random key pair
      Parameters:
      random - A secure random instance
      Returns:
      New key pair
    • createSeeded

      public static Ed25519KeyPair createSeeded(long seed)
      Create a deterministic key pair with a specified seed. SECURITY: Use for testing purpose only
      Parameters:
      seed - See to use for generation
      Returns:
      Key Pair instance
    • create

      public static Ed25519KeyPair create(byte[] keyMaterial)
      Create a SignKeyPair from given private key material. Public key is generated automatically from the private key
      Parameters:
      keyMaterial - An array of 32 bytes of random material to use for private key
      Returns:
      A new key pair using the given private key
    • create

      public static Ed25519KeyPair create(PrivateKey privateKey)
      Create a KeyPair from given private key. Public key is generated automatically from the private key
      Parameters:
      privateKey - An PrivateKey item for private key
      Returns:
      A new key pair using the given private key
    • getEncodedPrivateKey

      public Blob getEncodedPrivateKey()
      Description copied from class: AKeyPair
      Gets the Private key encoded as a Blob
      Specified by:
      getEncodedPrivateKey in class AKeyPair
      Returns:
      Blob Private key data encoding
    • getPublicKeyBytes

      public byte[] getPublicKeyBytes()
      Gets a byte array representation of the public key
      Returns:
      Bytes of public key
    • privateKeyFromBytes

      public static PrivateKey privateKeyFromBytes(byte[] key)
      Creates a private key using the given raw bytes.
      Parameters:
      key - 32 bytes private key data
      Returns:
      Ed25519 Private Key instance
    • getPublic

      public PublicKey getPublic()
      Description copied from class: AKeyPair
      Gets the JCA PublicKey
      Specified by:
      getPublic in class AKeyPair
      Returns:
      Public Key
    • getJCAKeyPair

      public KeyPair getJCAKeyPair()
      Description copied from class: AKeyPair
      Gets the JCA representation of this Key Pair
      Specified by:
      getJCAKeyPair in class AKeyPair
      Returns:
      JCA KepPair
    • getPrivate

      public PrivateKey getPrivate()
      Description copied from class: AKeyPair
      Gets the JCA PrivateKey
      Specified by:
      getPrivate in class AKeyPair
      Returns:
      Private Key
    • getAccountKey

      public AccountKey getAccountKey()
      Description copied from class: AKeyPair
      Gets the Account Public Key of this KeyPair
      Specified by:
      getAccountKey in class AKeyPair
      Returns:
      AccountKey for this KeyPair
    • signData

      public <R extends ACell> SignedData<R> signData(R value)
      Description copied from class: AKeyPair
      Signs a value with this key pair
      Specified by:
      signData in class AKeyPair
      Type Parameters:
      R - Type of Value
      Parameters:
      value - Value to sign. Can be any valid CVM value.
      Returns:
      Signed Data Object
    • sign

      public ASignature sign(Hash hash)
      Description copied from class: AKeyPair
      Signs a hash value with this key pair, producing a signature of the appropriate type.
      Specified by:
      sign in class AKeyPair
      Parameters:
      hash - Hash of value to sign
      Returns:
      A Signature compatible with the key pair.
    • equals

      public boolean equals(Object o)
      Specified by:
      equals in class AKeyPair