|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.nimbusds.jose.jwk.JWK
public abstract class JWK
The base abstract class for JSON Web Keys (JWKs). It serialises to a JSON object.
The following JSON object members are common to all JWK types:
Example JWK (of the Elliptic Curve type):
{ "kty" : "EC", "crv" : "P-256", "x" : "MKBCTNIcKUSDii11ySs3526iDZ8AiTo7Tu6KPAqv7D4", "y" : "4Etl6SRW2YiLUrN5vfvVHuhp7x8PxltmWWlbbM4IFyM", "use" : "enc", "kid" : "1" }
Field Summary | |
---|---|
static javax.mail.internet.ContentType |
MIME_TYPE
The MIME type of JWK objects: application/jwk+json; charset=UTF-8 |
Constructor Summary | |
---|---|
JWK(KeyType kty,
Use use,
Algorithm alg,
String kid,
URL x5u,
Base64URL x5t,
List<Base64> x5c)
Creates a new JSON Web Key (JWK). |
Method Summary | |
---|---|
Algorithm |
getAlgorithm()
Gets the intended JOSE algorithm ( alg ) for this JWK. |
String |
getKeyID()
Gets the ID ( kid ) of this JWK. |
KeyType |
getKeyType()
Gets the type ( kty ) of this JWK. |
Use |
getKeyUse()
Gets the use ( use ) of this JWK. |
List<Base64> |
getX509CertChain()
Gets the X.509 certificate chain ( x5c ) of this JWK. |
Base64URL |
getX509CertThumbprint()
Gets the X.509 certificate thumbprint ( x5t ) of this JWK. |
URL |
getX509CertURL()
Gets the X.509 certificate URL ( x5u ) of this JWK. |
abstract boolean |
isPrivate()
Returns true if this JWK contains private or sensitive
(non-public) parameters. |
static JWK |
parse(net.minidev.json.JSONObject jsonObject)
Parses a JWK from the specified JSON object representation. |
static JWK |
parse(String s)
Parses a JWK from the specified JSON object string representation. |
net.minidev.json.JSONObject |
toJSONObject()
Returns a JSON object representation of this JWK. |
String |
toJSONString()
Returns the JSON object string representation of this JWK. |
abstract JWK |
toPublicJWK()
Creates a copy of this JWK with all private or sensitive parameters removed. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final javax.mail.internet.ContentType MIME_TYPE
application/jwk+json; charset=UTF-8
Constructor Detail |
---|
public JWK(KeyType kty, Use use, Algorithm alg, String kid, URL x5u, Base64URL x5t, List<Base64> x5c)
kty
- The key type. Must not be null
.use
- The key use, null
if not specified or if the key
is intended for signing as well as encryption.alg
- The intended JOSE algorithm for the key, null
if
not specified.kid
- The key ID, null
if not specified.x5u
- The X.509 certificate URL, null
if not specified.x5t
- The X.509 certificate thumbprint, null
if not
specified.x5c
- The X.509 certificate chain, null
if not
specified.Method Detail |
---|
public KeyType getKeyType()
kty
) of this JWK.
public Use getKeyUse()
use
) of this JWK.
null
if not specified or if the key is
intended for signing as well as encryption.public Algorithm getAlgorithm()
alg
) for this JWK.
null
if not specified.public String getKeyID()
kid
) of this JWK. The key ID can be used to
match a specific key. This can be used, for instance, to choose a
key within a JWKSet
during key rollover. The key ID may also
correspond to a JWS/JWE kid
header parameter value.
null
if not specified.public URL getX509CertURL()
x5u
) of this JWK.
null
if not specified.public Base64URL getX509CertThumbprint()
x5t
) of this JWK.
null
if not
specified.public List<Base64> getX509CertChain()
x5c
) of this JWK.
null
if not specified.public abstract boolean isPrivate()
true
if this JWK contains private or sensitive
(non-public) parameters.
true
if this JWK contains private parameters, else
false
.public abstract JWK toPublicJWK()
null
if none can be
created.public net.minidev.json.JSONObject toJSONObject()
Example:
{ "kty" : "RSA", "use" : "sig", "kid" : "fd28e025-8d24-48bc-a51a-e2ffc8bc274b" }
public String toJSONString()
toJSONString
in interface net.minidev.json.JSONAware
public String toString()
toString
in class Object
toJSONString()
public static JWK parse(String s) throws ParseException
ECKey
, an RSAKey
, or a
OctetSequenceKey
.
s
- The JSON object string to parse. Must not be null
.
ParseException
- If the string couldn't be parsed to a
supported JWK.public static JWK parse(net.minidev.json.JSONObject jsonObject) throws ParseException
ECKey
, an RSAKey
, or a
OctetSequenceKey
.
jsonObject
- The JSON object to parse. Must not be
null
.
ParseException
- If the JSON object couldn't be parsed to a
supported JWK.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |