Package com.exonum.binding.common.crypto
Interface CryptoFunction
-
- All Known Implementing Classes:
Ed25519CryptoFunction
public interface CryptoFunctionA crypto function that provides several signature system crypto methods. All method arguments can't be null otherwiseNullPointerExceptionwill be thrown.
-
-
Method Summary
Modifier and Type Method Description KeyPairgenerateKeyPair()Generates a private key and a corresponding public key using a random seed.KeyPairgenerateKeyPair(byte[] seed)Generates a private key and a corresponding public key using aseedbyte array.byte[]signMessage(byte[] message, PrivateKey privateKey)Given aprivateKey, computes and returns a signature for the suppliedmessage.booleanverify(byte[] message, byte[] signature, PublicKey publicKey)Given apublicKey, verifies thatsignatureis a valid signature for the suppliedmessage.
-
-
-
Method Detail
-
generateKeyPair
KeyPair generateKeyPair(byte[] seed)
Generates a private key and a corresponding public key using aseedbyte array.- Throws:
IllegalArgumentException- if the specified seed is not valid
-
generateKeyPair
KeyPair generateKeyPair()
Generates a private key and a corresponding public key using a random seed.
-
signMessage
byte[] signMessage(byte[] message, PrivateKey privateKey)Given aprivateKey, computes and returns a signature for the suppliedmessage.- Returns:
- signature as a byte array
- Throws:
IllegalArgumentException- if the private key is not valid for this cryptographic function
-
verify
boolean verify(byte[] message, byte[] signature, PublicKey publicKey)Given apublicKey, verifies thatsignatureis a valid signature for the suppliedmessage.- Returns:
- true if signature is valid, false otherwise
-
-