Package com.exonum.binding.common.crypto
Enum Ed25519CryptoFunction
- java.lang.Object
-
- java.lang.Enum<Ed25519CryptoFunction>
-
- com.exonum.binding.common.crypto.Ed25519CryptoFunction
-
- All Implemented Interfaces:
CryptoFunction,Serializable,Comparable<Ed25519CryptoFunction>,java.lang.constant.Constable
public enum Ed25519CryptoFunction extends Enum<Ed25519CryptoFunction> implements CryptoFunction
A ED25519 public-key signature system crypto function.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
-
Enum Constant Summary
Enum Constants Enum Constant Description INSTANCE
-
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.static Ed25519CryptoFunctionvalueOf(String name)Returns the enum constant of this type with the specified name.static Ed25519CryptoFunction[]values()Returns an array containing the constants of this enum type, in the order they are declared.booleanverify(byte[] message, byte[] signature, PublicKey publicKey)Given apublicKey, verifies thatsignatureis a valid signature for the suppliedmessage.
-
-
-
Enum Constant Detail
-
INSTANCE
public static final Ed25519CryptoFunction INSTANCE
-
-
Method Detail
-
values
public static Ed25519CryptoFunction[] values()
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Ed25519CryptoFunction valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
generateKeyPair
public KeyPair generateKeyPair(byte[] seed)
Description copied from interface:CryptoFunctionGenerates a private key and a corresponding public key using aseedbyte array.- Specified by:
generateKeyPairin interfaceCryptoFunction
-
generateKeyPair
public KeyPair generateKeyPair()
Description copied from interface:CryptoFunctionGenerates a private key and a corresponding public key using a random seed.- Specified by:
generateKeyPairin interfaceCryptoFunction
-
signMessage
public byte[] signMessage(byte[] message, PrivateKey privateKey)Description copied from interface:CryptoFunctionGiven aprivateKey, computes and returns a signature for the suppliedmessage.- Specified by:
signMessagein interfaceCryptoFunction- Returns:
- signature as a byte array
-
verify
public boolean verify(byte[] message, byte[] signature, PublicKey publicKey)Description copied from interface:CryptoFunctionGiven apublicKey, verifies thatsignatureis a valid signature for the suppliedmessage.- Specified by:
verifyin interfaceCryptoFunction- Returns:
- true if signature is valid, false otherwise
-
-