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
,java.io.Serializable
,java.lang.Comparable<Ed25519CryptoFunction>
public enum Ed25519CryptoFunction extends java.lang.Enum<Ed25519CryptoFunction> implements CryptoFunction
A ED25519 public-key signature system crypto function.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description INSTANCE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description KeyPair
generateKeyPair()
Generates a private key and a corresponding public key using a random seed.KeyPair
generateKeyPair(byte[] seed)
Generates a private key and a corresponding public key using aseed
byte array.byte[]
signMessage(byte[] message, PrivateKey privateKey)
Given aprivateKey
, computes and returns a signature for the suppliedmessage
.static Ed25519CryptoFunction
valueOf(java.lang.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.boolean
verify(byte[] message, byte[] signature, PublicKey publicKey)
Given apublicKey
, verifies thatsignature
is 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. This method may be used to iterate over the constants as follows:for (Ed25519CryptoFunction c : Ed25519CryptoFunction.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Ed25519CryptoFunction valueOf(java.lang.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:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
generateKeyPair
public KeyPair generateKeyPair(byte[] seed)
Description copied from interface:CryptoFunction
Generates a private key and a corresponding public key using aseed
byte array.- Specified by:
generateKeyPair
in interfaceCryptoFunction
-
generateKeyPair
public KeyPair generateKeyPair()
Description copied from interface:CryptoFunction
Generates a private key and a corresponding public key using a random seed.- Specified by:
generateKeyPair
in interfaceCryptoFunction
-
signMessage
public byte[] signMessage(byte[] message, PrivateKey privateKey)
Description copied from interface:CryptoFunction
Given aprivateKey
, computes and returns a signature for the suppliedmessage
.- Specified by:
signMessage
in interfaceCryptoFunction
- Returns:
- signature as a byte array
-
verify
public boolean verify(byte[] message, byte[] signature, PublicKey publicKey)
Description copied from interface:CryptoFunction
Given apublicKey
, verifies thatsignature
is a valid signature for the suppliedmessage
.- Specified by:
verify
in interfaceCryptoFunction
- Returns:
- true if signature is valid, false otherwise
-
-