Package com.nimbusds.jose.jwk
Class KeyUse
java.lang.Object
com.nimbusds.jose.jwk.KeyUse
- All Implemented Interfaces:
Serializable
Enumeration of public key uses. Represents the
use
parameter in a
JSON Web Key (JWK).
Public JWK use values:
- Version:
- 2019-10-03
- Author:
- Vladimir Dzhuvinov
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
static KeyUse
from
(X509Certificate cert) Infers the use of the public key in the specified X.509 certificate.getValue()
int
hashCode()
Returns the identifier of this public key use.static KeyUse
Parses a public key use from the specified JWKuse
parameter value.toString()
-
Field Details
-
SIGNATURE
Signature. -
ENCRYPTION
Encryption.
-
-
Constructor Details
-
KeyUse
Creates a new public key use with the specified identifier.- Parameters:
identifier
- The public key use identifier. Must not benull
.
-
-
Method Details
-
identifier
Returns the identifier of this public key use.- Returns:
- The identifier.
-
getValue
- See Also:
-
toString
-
equals
-
hashCode
-
parse
Parses a public key use from the specified JWKuse
parameter value.- Parameters:
s
- The string to parse. May benull
.- Returns:
- The public key use,
null
if none. - Throws:
ParseException
- If the string couldn't be parsed to a valid public key use.
-
from
Infers the use of the public key in the specified X.509 certificate. Note that there is no standard algorithm for mapping PKIX key usage to JWK use. See RFC 2459, section 4.2.1.3, as well as the underlying code for the chosen algorithm to infer JWK use.- Parameters:
cert
- The X.509 certificate. Must not benull
.- Returns:
- The inferred public key use,
null
if the use of the public key is not specified by the X.509 certificate or the use maps to bothSIGNATURE
andENCRYPTION
.
-