Package com.google.crypto.tink.subtle
Class Ed25519Sign
- java.lang.Object
-
- com.google.crypto.tink.subtle.Ed25519Sign
-
- All Implemented Interfaces:
PublicKeySign
public final class Ed25519Sign extends java.lang.Object implements PublicKeySign
Ed25519 signing.Usage
Ed25519Sign.KeyPair keyPair = Ed25519Sign.KeyPair.newKeyPair(); // securely store keyPair and share keyPair.getPublicKey() Ed25519Sign signer = new Ed25519Sign(keyPair.getPrivateKey()); byte[] signature = signer.sign(message);- Since:
- 1.1.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEd25519Sign.KeyPairDefines the KeyPair consisting of a private key and its corresponding public key.
-
Field Summary
Fields Modifier and Type Field Description static TinkFipsUtil.AlgorithmFipsCompatibilityFIPSstatic intSECRET_KEY_LEN
-
Constructor Summary
Constructors Constructor Description Ed25519Sign(byte[] privateKey)Constructs a Ed25519Sign with theprivateKey.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PublicKeySigncreate(Ed25519PrivateKey key)byte[]sign(byte[] data)Computes the signature fordata.
-
-
-
Field Detail
-
FIPS
public static final TinkFipsUtil.AlgorithmFipsCompatibility FIPS
-
SECRET_KEY_LEN
public static final int SECRET_KEY_LEN
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Ed25519Sign
public Ed25519Sign(byte[] privateKey) throws java.security.GeneralSecurityExceptionConstructs a Ed25519Sign with theprivateKey.- Parameters:
privateKey- 32-byte random sequence.- Throws:
java.security.GeneralSecurityException- if there is no SHA-512 algorithm defined inEngineFactory.MESSAGE_DIGEST.
-
-
Method Detail
-
create
public static PublicKeySign create(Ed25519PrivateKey key) throws java.security.GeneralSecurityException
- Throws:
java.security.GeneralSecurityException
-
sign
public byte[] sign(byte[] data) throws java.security.GeneralSecurityExceptionDescription copied from interface:PublicKeySignComputes the signature fordata.- Specified by:
signin interfacePublicKeySign- Returns:
- the signature of
data - Throws:
java.security.GeneralSecurityException
-
-