public class JWKSet extends Object
JSON Web Keys
(JWKs) as the value of its "keys" member.
Additional (custom) members of the JWK Set JSON object are also supported.
Example JSON Web Key (JWK) set:
{ "keys" : [ { "kty" : "EC", "crv" : "P-256", "x" : "MKBCTNIcKUSDii11ySs3526iDZ8AiTo7Tu6KPAqv7D4", "y" : "4Etl6SRW2YiLUrN5vfvVHuhp7x8PxltmWWlbbM4IFyM", "use" : "enc", "kid" : "1" }, { "kty" : "RSA", "n" : "0vx7agoebGcQSuuPiLJXZptN9nndrQmbXEps2aiAFbWhM78LhWx 4cbbfAAtVT86zwu1RK7aPFFxuhDR1L6tSoc_BJECPebWKRXjBZCiFV4n3oknjhMs tn64tZ_2W-5JsGY4Hc5n9yBXArwl93lqt7_RN5w6Cf0h4QyQ5v-65YGjQR0_FDW2 QvzqY368QQMicAtaSqzs8KJZgnYb9c7d0zgdAZHzu6qMQvRL5hajrn1n91CbOpbI SD08qNLyrdkt-bFTWhAI4vMQFh6WeZu0fM4lFd2NcRwr3XPksINHaQ-G_xBniIqb w0Ls1jF44-csFCur-kEgU8awapJzKnqDKgw", "e" : "AQAB", "alg" : "RS256", "kid" : "2011-04-29" } ] }
Modifier and Type | Field and Description |
---|---|
static javax.mail.internet.ContentType |
MIME_TYPE
The MIME type of JWK set objects:
application/jwk-set+json; charset=UTF-8 |
Constructor and Description |
---|
JWKSet()
Creates a new empty JSON Web Key (JWK) set.
|
JWKSet(JWK key)
Creates a new JSON Web Key (JWK) set with a single key.
|
JWKSet(List<JWK> keys)
Creates a new JSON Web Key (JWK) set with the specified keys.
|
JWKSet(List<JWK> keys,
Map<String,Object> customMembers)
Creates a new JSON Web Key (JWK) set with the specified keys and
additional custom members.
|
Modifier and Type | Method and Description |
---|---|
Map<String,Object> |
getAdditionalMembers()
Gets the additional custom members of this JSON Web Key (JWK) set.
|
JWK |
getKeyByKeyId(String kid)
Gets the key from this JSON Web Key (JWK) set as identified by its
Key ID (kid) member.
|
List<JWK> |
getKeys()
Gets the keys (ordered) of this JSON Web Key (JWK) set.
|
static JWKSet |
parse(net.minidev.json.JSONObject json)
Parses the specified JSON object representing a JSON Web Key (JWK)
set.
|
static JWKSet |
parse(String s)
Parses the specified string representing a JSON Web Key (JWK) set.
|
net.minidev.json.JSONObject |
toJSONObject()
Returns the JSON object representation of this JSON Web Key (JWK)
set.
|
net.minidev.json.JSONObject |
toJSONObject(boolean publicParamsOnly)
Returns the JSON object representation of this JSON Web Key (JWK)
set.
|
String |
toString()
Returns the JSON object string representation of this JSON Web Key
(JWK) set.
|
public static final javax.mail.internet.ContentType MIME_TYPE
application/jwk-set+json; charset=UTF-8
public JWKSet()
public JWKSet(JWK key)
key
- The JWK. Must not be null
.public JWKSet(List<JWK> keys)
keys
- The JWK list. Must not be null
.public List<JWK> getKeys()
public JWK getKeyByKeyId(String kid)
If more than one key exists in the JWK Set with the same identifier, this function returns only the first one in the set.
kid
or null
if no key
exists.public Map<String,Object> getAdditionalMembers()
public net.minidev.json.JSONObject toJSONObject()
toJSONObject(boolean)
method if you wish to include them.public net.minidev.json.JSONObject toJSONObject(boolean publicParamsOnly)
publicParamsOnly
- Controls the inclusion of sensitive
non-public key parameters into the output
JWK members. If true
sensitive and
private parameters, such as private EC and
RSA key details and symmetric secret values,
will be omitted. If false
all
available key parameters will be included.public String toString()
public static JWKSet parse(String s) throws ParseException
s
- The string to parse. Must not be null
.ParseException
- If the string couldn't be parsed to a valid
JSON Web Key (JWK) set.public static JWKSet parse(net.minidev.json.JSONObject json) throws ParseException
json
- The JSON object to parse. Must not be null
.ParseException
- If the string couldn't be parsed to a valid
JSON Web Key (JWK) set.Copyright © 2013 NimbusDS. All Rights Reserved.