Package com.nimbusds.jose.jwk
Class KeyType
java.lang.Object
com.nimbusds.jose.jwk.KeyType
- All Implemented Interfaces:
Serializable
Key type. Represents the
kty parameter in a JSON Web Key (JWK).
This class is immutable.
Includes constants for the following standard key types:
Additional key types can be defined using the constructor.
- Version:
- 2017-08-23
- Author:
- Vladimir Dzhuvinov, Justin Richer
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionKeyType(String value, Requirement req) Creates a new key type with the specified value and implementation requirement. -
Method Summary
Modifier and TypeMethodDescriptionbooleanOverridesObject.equals().static KeyTypeforAlgorithm(Algorithm alg) Infers the key type for the specified JOSE algorithm.Gets the implementation requirement of this key type.getValue()Gets the value of this key type.inthashCode()OverridesObject.hashCode().static KeyTypeParses a key type from the specifiedktyparameter value.Returns the JSON string representation of this key type.toString()Returns the string representation of this key type.
-
Field Details
-
EC
Elliptic Curve (DSS) key type (recommended). -
RSA
RSA (RFC 3447) key type (required). -
OCT
Octet sequence key type (optional). -
OKP
Octet key pair (optional).
-
-
Constructor Details
-
KeyType
Creates a new key type with the specified value and implementation requirement.- Parameters:
value- The key type value. Values are case-sensitive. Must not benull.req- The implementation requirement,nullif not known.
-
-
Method Details
-
getValue
Gets the value of this key type. Values are case-sensitive.- Returns:
- The key type.
-
getRequirement
Gets the implementation requirement of this key type.- Returns:
- The implementation requirement,
nullif not known.
-
hashCode
OverridesObject.hashCode(). -
equals
OverridesObject.equals(). -
toString
Returns the string representation of this key type. -
toJSONString
Returns the JSON string representation of this key type.- Returns:
- The JSON string representation.
-
parse
Parses a key type from the specifiedktyparameter value.- Parameters:
s- The string to parse. Must not benull.- Returns:
- The key type (matching standard key type constant, else a newly created one).
-
forAlgorithm
Infers the key type for the specified JOSE algorithm.- Parameters:
alg- The JOSE algorithm. May benull.- Returns:
- The key type,
nullif it couldn't be inferred.
-