Package com.auth0.jwt.algorithms
Class ECDSAAlgorithm
java.lang.Object
com.auth0.jwt.algorithms.Algorithm
com.auth0.jwt.algorithms.ECDSAAlgorithm
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CryptoHelper
private final int
private final ECDSAKeyProvider
-
Constructor Summary
ConstructorsConstructorDescriptionECDSAAlgorithm
(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider) ECDSAAlgorithm
(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider) -
Method Summary
Modifier and TypeMethodDescriptionprivate int
countPadding
(byte[] bytes, int fromIndex, int toIndex) (package private) byte[]
DERToJOSE
(byte[] derSignature) Getter for the Id of the Private Key used to sign the tokens.(package private) byte[]
JOSEToDER
(byte[] joseSignature) (package private) static ECDSAKeyProvider
providerForKeys
(ECPublicKey publicKey, ECPrivateKey privateKey) byte[]
sign
(byte[] contentBytes) Deprecated.byte[]
sign
(byte[] headerBytes, byte[] payloadBytes) Sign the given content using this Algorithm instance.void
verify
(DecodedJWT jwt) Verify the given token using this Algorithm instance.Methods inherited from class com.auth0.jwt.algorithms.Algorithm
ECDSA256, ECDSA256, ECDSA256, ECDSA384, ECDSA384, ECDSA384, ECDSA512, ECDSA512, ECDSA512, getDescription, getName, HMAC256, HMAC256, HMAC384, HMAC384, HMAC512, HMAC512, none, RSA256, RSA256, RSA256, RSA384, RSA384, RSA384, RSA512, RSA512, RSA512, toString
-
Field Details
-
keyProvider
-
crypto
-
ecNumberSize
private final int ecNumberSize
-
-
Constructor Details
-
ECDSAAlgorithm
ECDSAAlgorithm(CryptoHelper crypto, String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
ECDSAAlgorithm
ECDSAAlgorithm(String id, String algorithm, int ecNumberSize, ECDSAKeyProvider keyProvider) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
-
Method Details
-
verify
Description copied from class:Algorithm
Verify the given token using this Algorithm instance.- Specified by:
verify
in classAlgorithm
- Parameters:
jwt
- the already decoded JWT that it's going to be verified.- Throws:
SignatureVerificationException
- if the Token's Signature is invalid, meaning that it doesn't match the signatureBytes, or if the Key is invalid.
-
sign
Description copied from class:Algorithm
Sign the given content using this Algorithm instance.- Overrides:
sign
in classAlgorithm
- Parameters:
headerBytes
- an array of bytes representing the base64 encoded header content to be verified against the signature.payloadBytes
- an array of bytes representing the base64 encoded payload content to be verified against the signature.- Returns:
- the signature in a base64 encoded array of bytes
- Throws:
SignatureGenerationException
- if the Key is invalid.
-
sign
Deprecated.Description copied from class:Algorithm
Sign the given content using this Algorithm instance.- Specified by:
sign
in classAlgorithm
- Parameters:
contentBytes
- an array of bytes representing the base64 encoded content to be verified against the signature.- Returns:
- the signature in a base64 encoded array of bytes
- Throws:
SignatureGenerationException
- if the Key is invalid.
-
getSigningKeyId
Description copied from class:Algorithm
Getter for the Id of the Private Key used to sign the tokens. This is usually specified as the `kid` claim in the Header.- Overrides:
getSigningKeyId
in classAlgorithm
- Returns:
- the Key Id that identifies the Signing Key or null if it's not specified.
-
DERToJOSE
- Throws:
SignatureException
-
JOSEToDER
- Throws:
SignatureException
-
countPadding
private int countPadding(byte[] bytes, int fromIndex, int toIndex) -
providerForKeys
-