Package org.forgerock.json.jose.jwk
Class OctJWK
- java.lang.Object
-
- org.forgerock.json.jose.jwk.JWK
-
- org.forgerock.json.jose.jwk.OctJWK
-
public class OctJWK extends JWK
Creates an Octet JWK.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OctJWK.Builder
The Octet JWK builder.
-
Field Summary
-
Fields inherited from class org.forgerock.json.jose.jwk.JWK
JSON_KEY_ALG, JSON_KEY_KID, JSON_KEY_KTY, JSON_KEY_OPERATIONS, JSON_KEY_USE, JSON_KEY_X5C, JSON_KEY_X5T, JSON_KEY_X5T_S256, JSON_KEY_X5U
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OctJWK.Builder
builder(String key)
Get the Octet JWK builder.String
getKey()
Gets the symmetric key.protected Optional<JWK.Builder<?>>
getPublicJwkBuilder()
Return a builder with all the values set for representing the public components of the JWK.boolean
isPrivate()
Indicates if any private key attributes are present in the JWK.static OctJWK
parse(String json)
Parses a OctJWK object from a string json object.static OctJWK
parse(JsonValue json)
Parses a OctJWK object from a jsonValue object.JsonValue
toJsonValue()
Returns a json representation of the JWK.SecretKey
toSecretKey()
Returns the key as a secret key.-
Methods inherited from class org.forgerock.json.jose.jwk.JWK
getAlgorithm, getAlgorithm, getJwaAlgorithm, getJwkThumbprint, getKeyId, getKeyOperations, getKeyType, getUse, getX509Chain, getX509Thumbnail, getX509Thumbprint, getX509ThumbprintS256, getX509URL, loadJWKFromJson, putField, toCryptoKey, toJsonString, toJsonValue, toPublicJwk, toSecretBuilder
-
-
-
-
Constructor Detail
-
OctJWK
@Deprecated public OctJWK(String use, String alg, String kid, String key, String x5u, String x5t, List<String> x5c)
Deprecated.Use the builder instead.Constructs a OctJWK.- Parameters:
use
- the JWK usealg
- the JWK algorithmkid
- the JWK key idkey
- the symmetric keyx5u
- the x509 url for the keyx5t
- the x509 thumbnail for the keyx5c
- the x509 chain as a list of Base64 encoded strings
-
-
Method Detail
-
builder
public static OctJWK.Builder builder(String key)
Get the Octet JWK builder.- Parameters:
key
- the symmetric key- Returns:
- the builder
-
getKey
public String getKey()
Gets the symmetric key.- Returns:
- the symmetric key that is Base64url encoded
-
toSecretKey
public SecretKey toSecretKey()
Returns the key as a secret key.- Returns:
- the secret key bytes.
-
parse
public static OctJWK parse(String json)
Parses a OctJWK object from a string json object.- Parameters:
json
- string json object- Returns:
- a OctJWK
-
parse
public static OctJWK parse(JsonValue json)
Parses a OctJWK object from a jsonValue object.- Parameters:
json
- an JsonValue object- Returns:
- a OctJWK
-
toJsonValue
public JsonValue toJsonValue()
Description copied from class:JWK
Returns a json representation of the JWK.- Overrides:
toJsonValue
in classJWK
- Returns:
- A JSON representation.
-
isPrivate
public boolean isPrivate()
Description copied from class:JWK
Indicates if any private key attributes are present in the JWK.
-
getPublicJwkBuilder
protected Optional<JWK.Builder<?>> getPublicJwkBuilder()
Description copied from class:JWK
Return a builder with all the values set for representing the public components of the JWK. Common JWK attributes will be added inJWK.toPublicJwk()
.- Specified by:
getPublicJwkBuilder
in classJWK
- Returns:
- The builder.
-
-