Package com.nimbusds.jose.jwk
Class Curve
- java.lang.Object
-
- com.nimbusds.jose.jwk.Curve
-
- All Implemented Interfaces:
Serializable
@Immutable public final class Curve extends Object implements 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:
- 2021-07-02
- Author:
- Vladimir Dzhuvinov, Aleksei Doroganov
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static CurveEd25519Ed25519 signature algorithm key pairs.static CurveEd448Ed448 signature algorithm key pairs.static CurveP_256P-256 curve (secp256r1, also called prime256v1, OID = 1.2.840.10045.3.1.7).static CurveP_256KDeprecated.UseSECP256K1.static CurveP_384P-384 curve (secp384r1, OID = 1.3.132.0.34).static CurveP_521P-521 curve (secp521r1).static CurveSECP256K1secp256k1 curve (secp256k1, OID = 1.3.132.0.10).static CurveX25519X25519 function key pairs.static CurveX448X448 function key pairs.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object object)static CurveforECParameterSpec(ECParameterSpec spec)Gets the cryptographic curve for the specified parameter specification.static Set<Curve>forJWSAlgorithm(JWSAlgorithm alg)Gets the cryptographic curve(s) for the specified JWS algorithm.static CurveforOID(String oid)Gets the cryptographic curve for the specified object identifier (OID).static CurveforStdName(String stdName)Gets the cryptographic curve for the specified standard name.StringgetName()Returns the JOSE name of this cryptographic curve.StringgetOID()Returns the standard object identifier (OID) of this cryptographic curve.StringgetStdName()Returns the standard name of this cryptographic curve.inthashCode()static Curveparse(String s)Parses a cryptographic curve from the specified string.ECParameterSpectoECParameterSpec()Returns the parameter specification for this cryptographic curve.StringtoString()
-
-
-
Constructor Detail
-
Curve
public Curve(String name)
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
public Curve(String name, String stdName, String oid)
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,nullif not specified.oid- The object identifier (OID) of the cryptographic curve,nullif not specified.
-
-
Method Detail
-
getName
public String getName()
Returns the JOSE name of this cryptographic curve.- Returns:
- The JOSE name.
-
getStdName
public String getStdName()
Returns the standard name of this cryptographic curve.- Returns:
- The standard name,
nullif not specified.
-
getOID
public String getOID()
Returns the standard object identifier (OID) of this cryptographic curve.- Returns:
- The OID,
nullif not specified.
-
toECParameterSpec
public ECParameterSpec toECParameterSpec()
Returns the parameter specification for this cryptographic curve.- Returns:
- The EC parameter specification,
nullif it cannot be determined.
-
parse
public static Curve parse(String s)
Parses a cryptographic curve from the specified string.- Parameters:
s- The string to parse. Must not benullor empty.- Returns:
- The cryptographic curve.
-
forStdName
public static Curve forStdName(String stdName)
Gets the cryptographic curve for the specified standard name.- Parameters:
stdName- The standard curve name. May benull.- Returns:
- The curve,
nullif it cannot be determined.
-
forOID
public static Curve forOID(String oid)
Gets the cryptographic curve for the specified object identifier (OID).- Parameters:
oid- The object OID. May benull.- Returns:
- The curve,
nullif it cannot be determined.
-
forJWSAlgorithm
public static Set<Curve> forJWSAlgorithm(JWSAlgorithm alg)
Gets the cryptographic curve(s) for the specified JWS algorithm.- Parameters:
alg- The JWS algorithm. May benull.- Returns:
- The curve(s),
nullif the JWS algorithm is not curve based, or the JWS algorithm is not supported.
-
forECParameterSpec
public static Curve forECParameterSpec(ECParameterSpec spec)
Gets the cryptographic curve for the specified parameter specification.- Parameters:
spec- The EC parameter spec. May benull.- Returns:
- The curve,
nullif it cannot be determined.
-
-