@Immutable public class OctetSequenceKey extends JWK
Octet sequence JSON Web Key (JWK), used to represent
symmetric keys. This class is immutable.
Example JSON object representation of an octet sequence JWK:
{
"kty" : "oct",
"alg" : "A128KW",
"k" : "GawgguFyGrWKav7AX4VKUg"
}
| Modifier and Type | Class and Description |
|---|---|
static class |
OctetSequenceKey.Builder
Builder for constructing octet sequence JWKs.
|
| Constructor and Description |
|---|
OctetSequenceKey(Base64URL k,
KeyUse use,
Set<KeyOperation> ops,
Algorithm alg,
String kid,
URL x5u,
Base64URL x5t,
List<Base64> x5c)
Creates a new octet sequence JSON Web Key (JWK) with the specified
parameters.
|
| Modifier and Type | Method and Description |
|---|---|
Base64URL |
getKeyValue()
Returns the value of this octet sequence key.
|
boolean |
isPrivate()
Octet sequence (symmetric) keys are never considered public, this
method always returns
true. |
static OctetSequenceKey |
parse(net.minidev.json.JSONObject jsonObject)
Parses an octet sequence JWK from the specified JSON object
representation.
|
static OctetSequenceKey |
parse(String s)
Parses an octet sequence JWK from the specified JSON object string
representation.
|
byte[] |
toByteArray()
Returns a copy of this octet sequence key value as a byte array.
|
net.minidev.json.JSONObject |
toJSONObject()
Returns a JSON object representation of this JWK.
|
OctetSequenceKey |
toPublicJWK()
Octet sequence (symmetric) keys are never considered public, this
method always returns
null. |
getAlgorithm, getKeyID, getKeyOperations, getKeyType, getKeyUse, getX509CertChain, getX509CertThumbprint, getX509CertURL, toJSONString, toStringpublic OctetSequenceKey(Base64URL k, KeyUse use, Set<KeyOperation> ops, Algorithm alg, String kid, URL x5u, Base64URL x5t, List<Base64> x5c)
k - The key value. It is represented as the Base64URL
encoding of value's big endian representation. Must not
be null.use - The key use, null if not specified or if the key
is intended for signing as well as encryption.ops - The key operations, null if not specified.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.public Base64URL getKeyValue()
public byte[] toByteArray()
public boolean isPrivate()
true.public OctetSequenceKey toPublicJWK()
null.toPublicJWK in class JWKnullpublic net.minidev.json.JSONObject toJSONObject()
JWKExample:
{
"kty" : "RSA",
"use" : "sig",
"kid" : "fd28e025-8d24-48bc-a51a-e2ffc8bc274b"
}
toJSONObject in class JWKpublic static OctetSequenceKey parse(String s) throws ParseException
s - The JSON object string to parse. Must not be null.ParseException - If the string couldn't be parsed to an octet
sequence JWK.public static OctetSequenceKey parse(net.minidev.json.JSONObject jsonObject) throws ParseException
jsonObject - The JSON object to parse. Must not beParseException - If the JSON object couldn't be parsed to an
octet sequence JWK.Copyright © 2014 Connect2id Ltd.. All Rights Reserved.