Package com.auth0.jwt.algorithms
Class RSAAlgorithm
- java.lang.Object
-
- com.auth0.jwt.algorithms.Algorithm
-
- com.auth0.jwt.algorithms.RSAAlgorithm
-
class RSAAlgorithm extends Algorithm
-
-
Field Summary
Fields Modifier and Type Field Description private CryptoHelpercryptoprivate RSAKeyProviderkeyProvider
-
Constructor Summary
Constructors Constructor Description RSAAlgorithm(CryptoHelper crypto, java.lang.String id, java.lang.String algorithm, RSAKeyProvider keyProvider)RSAAlgorithm(java.lang.String id, java.lang.String algorithm, RSAKeyProvider keyProvider)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.StringgetSigningKeyId()Getter for the Id of the Private Key used to sign the tokens.(package private) static RSAKeyProviderproviderForKeys(java.security.interfaces.RSAPublicKey publicKey, java.security.interfaces.RSAPrivateKey privateKey)byte[]sign(byte[] contentBytes)Sign the given content using this Algorithm instance.byte[]sign(byte[] headerBytes, byte[] payloadBytes)Deprecated.voidverify(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 Detail
-
keyProvider
private final RSAKeyProvider keyProvider
-
crypto
private final CryptoHelper crypto
-
-
Constructor Detail
-
RSAAlgorithm
RSAAlgorithm(CryptoHelper crypto, java.lang.String id, java.lang.String algorithm, RSAKeyProvider keyProvider) throws java.lang.IllegalArgumentException
- Throws:
java.lang.IllegalArgumentException
-
RSAAlgorithm
RSAAlgorithm(java.lang.String id, java.lang.String algorithm, RSAKeyProvider keyProvider) throws java.lang.IllegalArgumentException- Throws:
java.lang.IllegalArgumentException
-
-
Method Detail
-
verify
public void verify(DecodedJWT jwt) throws SignatureVerificationException
Description copied from class:AlgorithmVerify the given token using this Algorithm instance.- Specified by:
verifyin 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
@Deprecated public byte[] sign(byte[] headerBytes, byte[] payloadBytes) throws SignatureGenerationExceptionDeprecated.Description copied from class:AlgorithmSign the given content using this Algorithm instance.- Overrides:
signin 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
public byte[] sign(byte[] contentBytes) throws SignatureGenerationExceptionDescription copied from class:AlgorithmSign the given content using this Algorithm instance.- Specified by:
signin 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
public java.lang.String getSigningKeyId()
Description copied from class:AlgorithmGetter for the Id of the Private Key used to sign the tokens. This is usually specified as the `kid` claim in the Header.- Overrides:
getSigningKeyIdin classAlgorithm- Returns:
- the Key Id that identifies the Signing Key or null if it's not specified.
-
providerForKeys
static RSAKeyProvider providerForKeys(java.security.interfaces.RSAPublicKey publicKey, java.security.interfaces.RSAPrivateKey privateKey)
-
-