Package com.nimbusds.jose.jwk
Class Curve
java.lang.Object
com.nimbusds.jose.jwk.Curve
- All Implemented Interfaces:
Serializable
Cryptographic curve. This class is immutable.
Includes constants for the following standard cryptographic curves:
See
- "Digital Signature Standard (DSS)", FIPS PUB 186-3, June 2009, National Institute of Standards and Technology (NIST).
- CFRG Elliptic Curve Diffie-Hellman (ECDH) and Signatures in JSON Object Signing and Encryption (JOSE) (RFC 8037).
- Version:
- 2024-04-20
- Author:
- Vladimir Dzhuvinov, Aleksei Doroganov
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Curve
Ed25519 signature algorithm key pairs.static final Curve
Ed448 signature algorithm key pairs.static final Curve
P-256 curve (secp256r1, also called prime256v1, OID = 1.2.840.10045.3.1.7).static final Curve
Deprecated.static final Curve
P-384 curve (secp384r1, OID = 1.3.132.0.34).static final Curve
P-521 curve (secp521r1).static final Curve
secp256k1 curve (secp256k1, OID = 1.3.132.0.10).static final Curve
X25519 function key pairs.static final Curve
X448 function key pairs. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
static Curve
Gets the cryptographic curve for the specified parameter specification.Gets the cryptographic curve(s) for the specified JWS algorithm.static Curve
Gets the cryptographic curve for the specified object identifier (OID).static Curve
forStdName
(String stdName) Gets the cryptographic curve for the specified standard name.getName()
Returns the JOSE name of this cryptographic curve.getOID()
Returns the standard object identifier (OID) of this cryptographic curve.Returns the standard name of this cryptographic curve.int
hashCode()
static Curve
Parses a cryptographic curve from the specified string.Returns the parameter specification for this cryptographic curve.toString()
-
Field Details
-
P_256
P-256 curve (secp256r1, also called prime256v1, OID = 1.2.840.10045.3.1.7). -
SECP256K1
secp256k1 curve (secp256k1, OID = 1.3.132.0.10). -
P_256K
Deprecated.UseSECP256K1
.P-256K curve. -
P_384
P-384 curve (secp384r1, OID = 1.3.132.0.34). -
P_521
P-521 curve (secp521r1). -
Ed25519
Ed25519 signature algorithm key pairs. -
Ed448
Ed448 signature algorithm key pairs. -
X25519
X25519 function key pairs. -
X448
X448 function key pairs.
-
-
Constructor Details
-
Curve
Creates a new cryptographic curve with the specified JOSE name. A standard curve name and object identifier (OID) are not unspecified.- Parameters:
name
- The JOSE name of the cryptographic curve. Must not benull
.
-
Curve
Creates a new cryptographic curve with the specified JOSE name, standard name and object identifier (OID).- Parameters:
name
- The JOSE name of the cryptographic curve. Must not benull
.stdName
- The standard name of the cryptographic curve,null
if not specified.oid
- The object identifier (OID) of the cryptographic curve,null
if not specified.
-
-
Method Details
-
getName
Returns the JOSE name of this cryptographic curve.- Returns:
- The JOSE name.
-
getStdName
Returns the standard name of this cryptographic curve.- Returns:
- The standard name,
null
if not specified.
-
getOID
Returns the standard object identifier (OID) of this cryptographic curve.- Returns:
- The OID,
null
if not specified.
-
toECParameterSpec
Returns the parameter specification for this cryptographic curve.- Returns:
- The EC parameter specification,
null
if it cannot be determined.
-
toString
-
equals
-
hashCode
-
parse
Parses a cryptographic curve from the specified string.- Parameters:
s
- The string to parse. Must not benull
or empty.- Returns:
- The cryptographic curve.
-
forStdName
Gets the cryptographic curve for the specified standard name.- Parameters:
stdName
- The standard curve name. May benull
.- Returns:
- The curve,
null
if it cannot be determined.
-
forOID
Gets the cryptographic curve for the specified object identifier (OID).- Parameters:
oid
- The object OID. May benull
.- Returns:
- The curve,
null
if it cannot be determined.
-
forJWSAlgorithm
Gets the cryptographic curve(s) for the specified JWS algorithm.- Parameters:
alg
- The JWS algorithm. May benull
.- Returns:
- The curve(s),
null
if the JWS algorithm is not curve based, or the JWS algorithm is not supported.
-
forECParameterSpec
Gets the cryptographic curve for the specified parameter specification.- Parameters:
spec
- The EC parameter spec. May benull
.- Returns:
- The curve,
null
if it cannot be determined.
-
SECP256K1
.