Package com.nimbusds.jose
Class JWSAlgorithm
java.lang.Object
com.nimbusds.jose.Algorithm
com.nimbusds.jose.JWSAlgorithm
- All Implemented Interfaces:
Serializable
JSON Web Signature (JWS) algorithm name, represents the
alg
header
parameter in JWS objects. Also used to represent integrity algorithm
(ia
) header parameters in JWE objects. This class is immutable.
Includes constants for the following standard JWS algorithm names:
Additional JWS algorithm names can be defined using the constructors.
- Version:
- 2018-03-28
- Author:
- Vladimir Dzhuvinov, Aleksei Doroganov
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final JWSAlgorithm
EdDSA signature algorithms (optional).static final JWSAlgorithm
ECDSA using P-256 (secp256r1) curve and SHA-256 hash algorithm (recommended).static final JWSAlgorithm
ECDSA using P-256K (secp256k1) curve and SHA-256 hash algorithm (optional).static final JWSAlgorithm
ECDSA using P-384 curve and SHA-384 hash algorithm (optional).static final JWSAlgorithm
ECDSA using P-521 curve and SHA-512 hash algorithm (optional).static final JWSAlgorithm
HMAC using SHA-256 hash algorithm (required).static final JWSAlgorithm
HMAC using SHA-384 hash algorithm (optional).static final JWSAlgorithm
HMAC using SHA-512 hash algorithm (optional).static final JWSAlgorithm
RSASSA-PSS using SHA-256 hash algorithm and MGF1 mask generation function with SHA-256 (optional).static final JWSAlgorithm
RSASSA-PSS using SHA-384 hash algorithm and MGF1 mask generation function with SHA-384 (optional).static final JWSAlgorithm
RSASSA-PSS using SHA-512 hash algorithm and MGF1 mask generation function with SHA-512 (optional).static final JWSAlgorithm
RSASSA-PKCS-v1_5 using SHA-256 hash algorithm (recommended).static final JWSAlgorithm
RSASSA-PKCS-v1_5 using SHA-384 hash algorithm (optional).static final JWSAlgorithm
RSASSA-PKCS-v1_5 using SHA-512 hash algorithm (optional). -
Constructor Summary
ConstructorsConstructorDescriptionJWSAlgorithm
(String name) Creates a new JSON Web Signature (JWS) algorithm name.JWSAlgorithm
(String name, Requirement req) Creates a new JSON Web Signature (JWS) algorithm name. -
Method Summary
Modifier and TypeMethodDescriptionstatic JWSAlgorithm
Parses a JWS algorithm from the specified string.Methods inherited from class com.nimbusds.jose.Algorithm
equals, getName, getRequirement, hashCode, toJSONString, toString
-
Field Details
-
HS256
HMAC using SHA-256 hash algorithm (required). -
HS384
HMAC using SHA-384 hash algorithm (optional). -
HS512
HMAC using SHA-512 hash algorithm (optional). -
RS256
RSASSA-PKCS-v1_5 using SHA-256 hash algorithm (recommended). -
RS384
RSASSA-PKCS-v1_5 using SHA-384 hash algorithm (optional). -
RS512
RSASSA-PKCS-v1_5 using SHA-512 hash algorithm (optional). -
ES256
ECDSA using P-256 (secp256r1) curve and SHA-256 hash algorithm (recommended). -
ES256K
ECDSA using P-256K (secp256k1) curve and SHA-256 hash algorithm (optional). -
ES384
ECDSA using P-384 curve and SHA-384 hash algorithm (optional). -
ES512
ECDSA using P-521 curve and SHA-512 hash algorithm (optional). -
PS256
RSASSA-PSS using SHA-256 hash algorithm and MGF1 mask generation function with SHA-256 (optional). -
PS384
RSASSA-PSS using SHA-384 hash algorithm and MGF1 mask generation function with SHA-384 (optional). -
PS512
RSASSA-PSS using SHA-512 hash algorithm and MGF1 mask generation function with SHA-512 (optional). -
EdDSA
EdDSA signature algorithms (optional).
-
-
Constructor Details
-
JWSAlgorithm
Creates a new JSON Web Signature (JWS) algorithm name.- Parameters:
name
- The algorithm name. Must not benull
.req
- The implementation requirement,null
if not known.
-
JWSAlgorithm
Creates a new JSON Web Signature (JWS) algorithm name.- Parameters:
name
- The algorithm name. Must not benull
.
-
-
Method Details
-
parse
Parses a JWS algorithm from the specified string.- Parameters:
s
- The string to parse. Must not benull
.- Returns:
- The JWS algorithm (matching standard algorithm constant, else a newly created algorithm).
-