Package org.forgerock.json.jose.jws
Enum Class SupportedEllipticCurve
- All Implemented Interfaces:
Serializable,Comparable<SupportedEllipticCurve>,Constable
Enumerates all supported elliptic curve parameters for ESXXX signature formats.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic SupportedEllipticCurveDetermines the standard curve that matches the given (private or public) key.static SupportedEllipticCurveReturns the curve parameters for the given standard curve name (crv claim in a JWK).static SupportedEllipticCurveforSignature(byte[] signature) Determines the supported curve parameters for the given signature.Returns the JwsAlgorithm that corresponds to this elliptic curve.Returns the parameters for the given elliptic curve.intReturns the size of the signature produced by this curve in octets.Return the name of the curve as used for the "crv" claim in a JWK.static SupportedEllipticCurveReturns the enum constant of this class with the specified name.static SupportedEllipticCurve[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
P256
NIST P-256. -
P384
NIST P-384. -
P521
NIST P-521. Please note that this is not a typo: ES512 uses curve P-521, which produces a 132-octet signature value.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getParameters
Returns the parameters for the given elliptic curve.- Returns:
- the elliptic curve algorithm parameters.
-
getStandardName
Return the name of the curve as used for the "crv" claim in a JWK.- Returns:
- the standard JWA name for the curve.
-
getSignatureSize
Returns the size of the signature produced by this curve in octets.- Returns:
- the number of octets (bytes) required to hold a signature of this curve.
-
getJwsAlgorithm
Returns the JwsAlgorithm that corresponds to this elliptic curve.- Returns:
- the corresponding JwsAlgorithm.
-
forName
Returns the curve parameters for the given standard curve name (crv claim in a JWK).- Parameters:
curveName- the curve name.- Returns:
- the curve parameters for the name.
- Throws:
IllegalArgumentException- if the curve name is not supported.
-
forKey
Determines the standard curve that matches the given (private or public) key. This is done by comparing the key parameters for an exact match against one of the standard curves. All parameters much match for a match to succeed.- Parameters:
key- the private or public key to determine the curve for.- Returns:
- the matching supported curve parameters.
- Throws:
IllegalArgumentException- if the key does not match any supported curve parameters.
-
forSignature
Determines the supported curve parameters for the given signature. This is done purely based on the length of the signature and the behaviour is not specified if multiple curves could have produced this signature.- Parameters:
signature- the signature to match.- Returns:
- the curve that produced this signature.
- Throws:
IllegalArgumentException- if the signature does not match any supported curve parameters.
-