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 Ed25519KeyPaircreate(byte[] keyMaterial) Create a SignKeyPair from given private key material.static Ed25519KeyPaircreate(AccountKey accountKey, Blob encodedPrivateKey) Create a key pair given a public AccountKey and a encoded Blobstatic Ed25519KeyPairprotected static Ed25519KeyPairCreate a KeyPair from a JCA KeyPairstatic Ed25519KeyPaircreate(PrivateKey privateKey) Create a KeyPair from given private key.static Ed25519KeyPaircreate(PublicKey publicKey, PrivateKey privateKey) Creates an Ed25519 Key Pair with the specified keysstatic Ed25519KeyPaircreateSeeded(long seed) Create a deterministic key pair with a specified seed.booleanstatic Ed25519KeyPairgenerate()Generates a new, secure random key pair.static Ed25519KeyPairgenerate(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 PrivateKeyprivateKeyFromBytes(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:AKeyPairGets the Private key encoded as a Blob- Specified by:
getEncodedPrivateKeyin 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:AKeyPairGets the JCA PublicKey -
getJCAKeyPair
Description copied from class:AKeyPairGets the JCA representation of this Key Pair- Specified by:
getJCAKeyPairin classAKeyPair- Returns:
- JCA KepPair
-
getPrivate
Description copied from class:AKeyPairGets the JCA PrivateKey- Specified by:
getPrivatein classAKeyPair- Returns:
- Private Key
-
getAccountKey
Description copied from class:AKeyPairGets the Account Public Key of this KeyPair- Specified by:
getAccountKeyin classAKeyPair- Returns:
- AccountKey for this KeyPair
-
signData
Description copied from class:AKeyPairSigns a value with this key pair -
sign
Description copied from class:AKeyPairSigns a hash value with this key pair, producing a signature of the appropriate type. -
equals
-