Package com.nimbusds.jose.jwk
Class KeyUse
- java.lang.Object
-
- com.nimbusds.jose.jwk.KeyUse
-
- All Implemented Interfaces:
Serializable
public final class KeyUse extends Object implements Serializable
Enumeration of public key uses. Represents theuseparameter in a JSON Web Key (JWK).Public JWK use values:
- Version:
- 2019-10-03
- Author:
- Vladimir Dzhuvinov
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static KeyUseENCRYPTIONEncryption.static KeyUseSIGNATURESignature.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)static KeyUsefrom(X509Certificate cert)Infers the public key use of the specified X.509 certificate.StringgetValue()inthashCode()Stringidentifier()Returns the identifier of this public key use.static KeyUseparse(String s)Parses a public key use from the specified JWKuseparameter value.StringtoString()
-
-
-
Field Detail
-
ENCRYPTION
public static final KeyUse ENCRYPTION
Encryption.
-
-
Method Detail
-
identifier
public String identifier()
Returns the identifier of this public key use.- Returns:
- The identifier.
-
getValue
public String getValue()
- See Also:
identifier()
-
toString
public String toString()
- Overrides:
toStringin classObject- See Also:
identifier()
-
parse
public static KeyUse parse(String s) throws ParseException
Parses a public key use from the specified JWKuseparameter value.- Parameters:
s- The string to parse. May benull.- Returns:
- The public key use,
nullif none. - Throws:
ParseException- If the string couldn't be parsed to a valid public key use.
-
from
public static KeyUse from(X509Certificate cert)
Infers the public key use of 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 public key use,
nullif the key use couldn't be reliably determined.
-
-