Package com.nimbusds.jose.crypto
Class Ed25519Signer
- java.lang.Object
-
- com.nimbusds.jose.crypto.impl.BaseJWSProvider
-
- com.nimbusds.jose.crypto.impl.EdDSAProvider
-
- com.nimbusds.jose.crypto.Ed25519Signer
-
- All Implemented Interfaces:
JCAAware<JCAContext>
,JOSEProvider
,JWSProvider
,JWSSigner
@ThreadSafe public class Ed25519Signer extends EdDSAProvider implements JWSSigner
Ed25519 signer ofJWS objects
. Expects anOctetKeyPair
with"crv"
Ed25519. Uses the Edwards-curve Digital Signature Algorithm (EdDSA).See RFC 8037 for more information.
This class is thread-safe.
Supports the following algorithm:
with the following curve:
- Version:
- 2018-07-11
- Author:
- Tim McLean
-
-
Field Summary
-
Fields inherited from class com.nimbusds.jose.crypto.impl.EdDSAProvider
SUPPORTED_ALGORITHMS
-
-
Constructor Summary
Constructors Constructor Description Ed25519Signer(OctetKeyPair privateKey)
Creates a new Ed25519 signer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OctetKeyPair
getPrivateKey()
Gets the Ed25519 private key as anOctetKeyPair
.Base64URL
sign(JWSHeader header, byte[] signingInput)
Signs the specifiedinput
of aJWS object
.-
Methods inherited from class com.nimbusds.jose.crypto.impl.BaseJWSProvider
getJCAContext, supportedJWSAlgorithms
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.nimbusds.jose.jca.JCAAware
getJCAContext
-
Methods inherited from interface com.nimbusds.jose.JWSProvider
supportedJWSAlgorithms
-
-
-
-
Constructor Detail
-
Ed25519Signer
public Ed25519Signer(OctetKeyPair privateKey) throws JOSEException
Creates a new Ed25519 signer.- Parameters:
privateKey
- The private key. Must be non-null
, and must be of type Ed25519 ("crv": "Ed25519"
).- Throws:
JOSEException
- If the key subtype is not supported or if the key is not a private key
-
-
Method Detail
-
getPrivateKey
public OctetKeyPair getPrivateKey()
Gets the Ed25519 private key as anOctetKeyPair
.- Returns:
- The private key.
-
sign
public Base64URL sign(JWSHeader header, byte[] signingInput) throws JOSEException
Description copied from interface:JWSSigner
Signs the specifiedinput
of aJWS object
.- Specified by:
sign
in interfaceJWSSigner
- Parameters:
header
- The JSON Web Signature (JWS) header. Must specify a supported JWS algorithm and must not benull
.signingInput
- The input to sign. Must not benull
.- Returns:
- The resulting signature part (third part) of the JWS object.
- Throws:
JOSEException
- If the JWS algorithm is not supported, if a critical header parameter is not supported or marked for deferral to the application, or if signing failed for some other internal reason.
-
-