Package | Description |
---|---|
io.jsonwebtoken | |
io.jsonwebtoken.security |
Modifier and Type | Method | Description |
---|---|---|
void |
SignatureAlgorithm.assertValidSigningKey(Key key) |
Returns quietly if the specified key is allowed to create signatures using this algorithm
according to the JWT JWA Specification (RFC 7518) or throws an
InvalidKeyException if the key is not allowed or not secure enough for this algorithm. |
void |
SignatureAlgorithm.assertValidVerificationKey(Key key) |
Returns quietly if the specified key is allowed to verify signatures using this algorithm
according to the JWT JWA Specification (RFC 7518) or throws an
InvalidKeyException if the key is not allowed or not secure enough for this algorithm. |
static SignatureAlgorithm |
SignatureAlgorithm.forSigningKey(Key key) |
Returns the recommended signature algorithm to be used with the specified key according to the following
heuristics:
Key Signature Algorithm
If the Key is a:
And:
With a key size of:
The returned SignatureAlgorithm will be:
SecretKey
1
256 <= size <= 383 2
HS256
SecretKey
1
384 <= size <= 511
HS384
SecretKey
1
512 <= size
HS512
ECKey
instanceof
256 <= size <= 383 3
ES256
ECKey
instanceof
384 <= size <= 511
ES384
ECKey
instanceof
4096 <= size
ES512
RSAKey
instanceof
2048 <= size <= 3071 4,5
RS256
RSAKey
instanceof
3072 <= size <= 4095 5
RS384
RSAKey
instanceof
4096 <= size 5
RS512
|
JwtBuilder |
JwtBuilder.signWith(SignatureAlgorithm alg,
byte[] secretKey) |
Deprecated.
as of 0.10.0: use
Keys .hmacShaKeyFor(bytes) to
obtain the Key and then invoke JwtBuilder.signWith(Key) or JwtBuilder.signWith(Key, SignatureAlgorithm) . |
JwtBuilder |
JwtBuilder.signWith(SignatureAlgorithm alg,
String base64EncodedSecretKey) |
Deprecated.
as of 0.10.0: use
JwtBuilder.signWith(Key) or JwtBuilder.signWith(Key, SignatureAlgorithm) instead. |
JwtBuilder |
JwtBuilder.signWith(SignatureAlgorithm alg,
Key key) |
Deprecated.
since 0.10.0: use
JwtBuilder.signWith(Key, SignatureAlgorithm) instead. |
JwtBuilder |
JwtBuilder.signWith(Key key) |
Signs the constructed JWT with the specified key using the key's
recommended signature algorithm , producing a JWS. |
JwtBuilder |
JwtBuilder.signWith(Key key,
SignatureAlgorithm alg) |
Signs the constructed JWT with the specified key using the specified algorithm, producing a JWS.
|
Modifier and Type | Class | Description |
---|---|---|
class |
WeakKeyException |
Copyright © 2019. All rights reserved.