Package convex.core.crypto
Class Ed25519KeyPair
java.lang.Object
convex.core.crypto.AKeyPair
convex.core.crypto.Ed25519KeyPair
Class representing an Ed25519 Key Pair
-
Method Summary
Modifier and TypeMethodDescriptionstatic Ed25519KeyPair
create(byte[] keyMaterial)
Create a SignKeyPair from given private key material.static Ed25519KeyPair
create(AccountKey accountKey, Blob encodedPrivateKey)
Create a key pair given a public AccountKey and a encoded Blobstatic Ed25519KeyPair
protected static Ed25519KeyPair
Create a KeyPair from a JCA KeyPairstatic Ed25519KeyPair
create(PrivateKey privateKey)
Create a KeyPair from given private key.static Ed25519KeyPair
create(PublicKey publicKey, PrivateKey privateKey)
Creates an Ed25519 Key Pair with the specified keysstatic Ed25519KeyPair
createSeeded(long seed)
Create a deterministic key pair with a specified seed.boolean
static Ed25519KeyPair
generate()
Generates a new, secure random key pair.static Ed25519KeyPair
generate(SecureRandom random)
Generates a secure random key pairGets the Account Public Key of this KeyPairGets the Private key encoded as a BlobGets the JCA representation of this Key PairGets the JCA PrivateKeyGets the JCA PublicKeybyte[]
Gets a byte array representation of the public keygetSeed()
static PrivateKey
privateKeyFromBytes(byte[] key)
Creates a private key using the given raw bytes.Signs a hash value with this key pair, producing a signature of the appropriate type.<R extends ACell>
SignedData<R>signData(R value)
Signs a value with this key pair
-
Method Details
-
create
-
generate
Generates a new, secure random key pair. Uses a Java SecureRandom instance.- Returns:
- New Key Pair instance.
-
create
Create a KeyPair from a JCA KeyPair- Parameters:
keyPair
- JCA KeyPair- Returns:
- AKeyPair instance
-
create
Creates an Ed25519 Key Pair with the specified keys- Parameters:
publicKey
- Public keyprivateKey
- Private key- Returns:
- Key Pair instance
-
create
Create a key pair given a public AccountKey and a encoded Blob- Parameters:
accountKey
- Public KeyencodedPrivateKey
- Encoded PKCS8 Private key- Returns:
- AKeyPair instance
-
getSeed
-
generate
Generates a secure random key pair- Parameters:
random
- A secure random instance- Returns:
- New key pair
-
createSeeded
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
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
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
Description copied from class:AKeyPair
Gets the Private key encoded as a Blob- Specified by:
getEncodedPrivateKey
in classAKeyPair
- 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
Creates a private key using the given raw bytes.- Parameters:
key
- 32 bytes private key data- Returns:
- Ed25519 Private Key instance
-
getPublic
Description copied from class:AKeyPair
Gets the JCA PublicKey -
getJCAKeyPair
Description copied from class:AKeyPair
Gets the JCA representation of this Key Pair- Specified by:
getJCAKeyPair
in classAKeyPair
- Returns:
- JCA KepPair
-
getPrivate
Description copied from class:AKeyPair
Gets the JCA PrivateKey- Specified by:
getPrivate
in classAKeyPair
- Returns:
- Private Key
-
getAccountKey
Description copied from class:AKeyPair
Gets the Account Public Key of this KeyPair- Specified by:
getAccountKey
in classAKeyPair
- Returns:
- AccountKey for this KeyPair
-
signData
Description copied from class:AKeyPair
Signs a value with this key pair -
sign
Description copied from class:AKeyPair
Signs a hash value with this key pair, producing a signature of the appropriate type. -
equals
-