@ThreadSafe public class Ed25519Signer extends Object implements JWSSigner
JWS objects
.
Expects an OctetKeyPair
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:
Modifier and Type | Field and Description |
---|---|
static Set<JWSAlgorithm> |
SUPPORTED_ALGORITHMS
The supported JWS algorithms by the EdDSA provider class.
|
Constructor and Description |
---|
Ed25519Signer(OctetKeyPair privateKey)
Creates a new Ed25519 signer.
|
Modifier and Type | Method and Description |
---|---|
JCAContext |
getJCAContext()
Returns the Java Cryptography Architecture (JCA) context.
|
OctetKeyPair |
getPrivateKey()
Gets the Ed25519 private key as an
OctetKeyPair . |
Base64URL |
sign(JWSHeader header,
byte[] signingInput)
Signs the specified
input of a
JWS object . |
Set<JWSAlgorithm> |
supportedJWSAlgorithms()
Returns the names of the supported algorithms by the JWS provider
instance.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
supportedJWSAlgorithms
getJCAContext
public static final Set<JWSAlgorithm> SUPPORTED_ALGORITHMS
public Ed25519Signer(OctetKeyPair privateKey) throws JOSEException
privateKey
- The private key. Must be non-null
, and must
be of type Ed25519 ("crv": "Ed25519"
).JOSEException
- If the key subtype is not supported or if the key is not a private keypublic OctetKeyPair getPrivateKey()
OctetKeyPair
.public Base64URL sign(JWSHeader header, byte[] signingInput) throws JOSEException
JWSSigner
input
of a
JWS object
.sign
in interface JWSSigner
header
- The JSON Web Signature (JWS) header. Must
specify a supported JWS algorithm and must not
be null
.signingInput
- The input to sign. Must not be null
.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.public Set<JWSAlgorithm> supportedJWSAlgorithms()
JWSProvider
alg
JWS header parameter.supportedJWSAlgorithms
in interface JWSProvider
public JCAContext getJCAContext()
JCAAware
getJCAContext
in interface JCAAware<JCAContext>
null
.Copyright © 2018 Connect2id Ltd.. All rights reserved.