public static final class Jwts.SIG extends Object
public static final
) constant for
direct type-safe reference in application code. For example:
Jwts.builder() // ... etc ... .signWith(aKey, Jwts.SIG.HS512) // or RS512, PS256, EdDSA, etc... .build();
They are also available together as a Registry
instance via the get()
method.
get()
Modifier and Type | Field and Description |
---|---|
static SignatureAlgorithm |
EdDSA
EdDSA signature algorithm defined by
RFC 8037, Section 3.1 that requires
either Ed25519 or Ed448 Edwards Elliptic Curve1 keys. |
static SignatureAlgorithm |
ES256
ECDSA using P-256 and SHA-256 signature algorithm as defined by
RFC 7518, Section 3.4. |
static SignatureAlgorithm |
ES384
ECDSA using P-384 and SHA-384 signature algorithm as defined by
RFC 7518, Section 3.4. |
static SignatureAlgorithm |
ES512
ECDSA using P-521 and SHA-512 signature algorithm as defined by
RFC 7518, Section 3.4. |
static MacAlgorithm |
HS256
HMAC using SHA-256 message authentication algorithm as defined by
RFC 7518, Section 3.2. |
static MacAlgorithm |
HS384
HMAC using SHA-384 message authentication algorithm as defined by
RFC 7518, Section 3.2. |
static MacAlgorithm |
HS512
HMAC using SHA-512 message authentication algorithm as defined by
RFC 7518, Section 3.2. |
static SecureDigestAlgorithm<Key,Key> |
NONE
The "none" signature algorithm as defined by
RFC 7518, Section 3.6.
|
static SignatureAlgorithm |
PS256
RSASSA-PSS using SHA-256 and MGF1 with SHA-256 signature algorithm as defined by
RFC 7518, Section 3.51. |
static SignatureAlgorithm |
PS384
RSASSA-PSS using SHA-384 and MGF1 with SHA-384 signature algorithm as defined by
RFC 7518, Section 3.51. |
static SignatureAlgorithm |
PS512
RSASSA-PSS using SHA-512 and MGF1 with SHA-512 signature algorithm as defined by
RFC 7518, Section 3.51. |
static SignatureAlgorithm |
RS256
RSASSA-PKCS1-v1_5 using SHA-256 signature algorithm as defined by
RFC 7518, Section 3.3. |
static SignatureAlgorithm |
RS384
RSASSA-PKCS1-v1_5 using SHA-384 signature algorithm as defined by
RFC 7518, Section 3.3. |
static SignatureAlgorithm |
RS512
RSASSA-PKCS1-v1_5 using SHA-512 signature algorithm as defined by
RFC 7518, Section 3.3. |
Modifier and Type | Method and Description |
---|---|
static Registry<String,SecureDigestAlgorithm<?,?>> |
get()
Returns all standard JWA Cryptographic
Algorithms for Digital Signatures and MACs defined in the
JSON Web Signature and Encryption
Algorithms Registry.
|
public static final SecureDigestAlgorithm<Key,Key> NONE
public static final MacAlgorithm HS256
HMAC using SHA-256
message authentication algorithm as defined by
RFC 7518, Section 3.2. This algorithm
requires a 256-bit (32 byte) key.public static final MacAlgorithm HS384
HMAC using SHA-384
message authentication algorithm as defined by
RFC 7518, Section 3.2. This algorithm
requires a 384-bit (48 byte) key.public static final MacAlgorithm HS512
HMAC using SHA-512
message authentication algorithm as defined by
RFC 7518, Section 3.2. This algorithm
requires a 512-bit (64 byte) key.public static final SignatureAlgorithm RS256
RSASSA-PKCS1-v1_5 using SHA-256
signature algorithm as defined by
RFC 7518, Section 3.3. This algorithm
requires a 2048-bit key.public static final SignatureAlgorithm RS384
RSASSA-PKCS1-v1_5 using SHA-384
signature algorithm as defined by
RFC 7518, Section 3.3. This algorithm
requires a 2048-bit key, but the JJWT team recommends a 3072-bit key.public static final SignatureAlgorithm RS512
RSASSA-PKCS1-v1_5 using SHA-512
signature algorithm as defined by
RFC 7518, Section 3.3. This algorithm
requires a 2048-bit key, but the JJWT team recommends a 4096-bit key.public static final SignatureAlgorithm PS256
RSASSA-PSS using SHA-256 and MGF1 with SHA-256
signature algorithm as defined by
RFC 7518, Section 3.51.
This algorithm requires a 2048-bit key.
1 Requires Java 11 or a compatible JCA Provider (like BouncyCastle) in the runtime classpath. If on Java 10 or earlier, BouncyCastle will be used automatically if found in the runtime classpath.
public static final SignatureAlgorithm PS384
RSASSA-PSS using SHA-384 and MGF1 with SHA-384
signature algorithm as defined by
RFC 7518, Section 3.51.
This algorithm requires a 2048-bit key, but the JJWT team recommends a 3072-bit key.
1 Requires Java 11 or a compatible JCA Provider (like BouncyCastle) in the runtime classpath. If on Java 10 or earlier, BouncyCastle will be used automatically if found in the runtime classpath.
public static final SignatureAlgorithm PS512
RSASSA-PSS using SHA-512 and MGF1 with SHA-512
signature algorithm as defined by
RFC 7518, Section 3.51.
This algorithm requires a 2048-bit key, but the JJWT team recommends a 4096-bit key.
1 Requires Java 11 or a compatible JCA Provider (like BouncyCastle) in the runtime classpath. If on Java 10 or earlier, BouncyCastle will be used automatically if found in the runtime classpath.
public static final SignatureAlgorithm ES256
ECDSA using P-256 and SHA-256
signature algorithm as defined by
RFC 7518, Section 3.4. This algorithm
requires a 256-bit key.public static final SignatureAlgorithm ES384
ECDSA using P-384 and SHA-384
signature algorithm as defined by
RFC 7518, Section 3.4. This algorithm
requires a 384-bit key.public static final SignatureAlgorithm ES512
ECDSA using P-521 and SHA-512
signature algorithm as defined by
RFC 7518, Section 3.4. This algorithm
requires a 521-bit key.public static final SignatureAlgorithm EdDSA
EdDSA
signature algorithm defined by
RFC 8037, Section 3.1 that requires
either Ed25519
or Ed448
Edwards Elliptic Curve1 keys.
KeyPair Generation
This instance's keyPair()
builder creates Ed448
keys,
and is essentially an alias for
.Jwks.CRV
.Ed448
.keyPair()
If you would like to generate an Ed25519
KeyPair
for use with the EdDSA
algorithm,
you may use the
builder instead.Jwks.CRV
.Ed25519
.keyPair()
1This algorithm requires at least JDK 15 or a compatible JCA Provider (like BouncyCastle) in the runtime classpath.
public static Registry<String,SecureDigestAlgorithm<?,?>> get()
Copyright © 2014–2025 jsonwebtoken.io. All rights reserved.