| Modifier and Type | Field and Description |
|---|---|
static String |
ALG_NONE
Algorithm defining there is no security (e.g.
|
static String |
KEY_TYPE_EC
Key type of elliptic curve keys.
|
static String |
KEY_TYPE_OCT
Key type of octet keys.
|
static String |
KEY_TYPE_RSA
Key type of RSA keys.
|
static Jwk |
NONE_JWK
A jwk with no fields filled and
ALG_NONE algorithm. |
static String |
OPERATION_DECRYPT
Decrypt content and validate decryption, if applicable.
|
static String |
OPERATION_DERIVE_BITS
Derive bits not to be used as a key.
|
static String |
OPERATION_DERIVE_KEY
Derive key.
|
static String |
OPERATION_ENCRYPT
Encrypt content.
|
static String |
OPERATION_SIGN
Compute digital signature or MAC.
|
static String |
OPERATION_UNWRAP_KEY
Decrypt key and validate decryption, if applicable.
|
static String |
OPERATION_VERIFY
Verify digital signature or MAC.
|
static String |
OPERATION_WRAP_KEY
Encrypt key.
|
static String |
PARAM_ALGORITHM
JWK parameter for algorithm.
|
static String |
PARAM_KEY_ID
JWK parameter for key id.
|
static String |
PARAM_KEY_TYPE
JWK parameter for key type.
|
static String |
PARAM_OPERATIONS
JWK parameters for permitted operations.
|
static String |
PARAM_USE
JWK parameter for usage.
|
static String |
USE_ENCRYPTION
Key can be used for encryption only.
|
static String |
USE_SIGNATURE
Key can be used for signatures only.
|
| Modifier and Type | Method and Description |
|---|---|
String |
algorithm()
The algorithm used when signing/encrypting this key.
|
static Jwk |
create(JsonObject json)
Create an instance from Json object.
|
String |
keyId()
The key id (kid) of this JWK.
|
String |
keyType()
The key type (kty) of this JWK.
|
Optional<List<String>> |
operations()
Permitted operations of this JWK.
|
byte[] |
sign(byte[] bytesToSign)
Sign the bytes to sign using this JWK type and algorithm.
|
String |
toString() |
Optional<String> |
usage()
Permitted usage of this JWK.
|
boolean |
verifySignature(byte[] signedBytes,
byte[] signature)
Verify that the signature is indeed for the signed bytes based on this JWK type
and algorithm.
|
public static final String ALG_NONE
public static final String KEY_TYPE_EC
public static final String KEY_TYPE_RSA
public static final String KEY_TYPE_OCT
public static final String USE_ENCRYPTION
public static final String USE_SIGNATURE
public static final String OPERATION_SIGN
PARAM_OPERATIONS,
Constant Field Valuespublic static final String OPERATION_VERIFY
PARAM_OPERATIONS,
Constant Field Valuespublic static final String OPERATION_ENCRYPT
PARAM_OPERATIONS,
Constant Field Valuespublic static final String OPERATION_DECRYPT
PARAM_OPERATIONS,
Constant Field Valuespublic static final String OPERATION_WRAP_KEY
PARAM_OPERATIONS,
Constant Field Valuespublic static final String OPERATION_UNWRAP_KEY
PARAM_OPERATIONS,
Constant Field Valuespublic static final String OPERATION_DERIVE_KEY
PARAM_OPERATIONS,
Constant Field Valuespublic static final String OPERATION_DERIVE_BITS
PARAM_OPERATIONS,
Constant Field Valuespublic static final String PARAM_KEY_TYPE
public static final String PARAM_KEY_ID
public static final String PARAM_ALGORITHM
public static final String PARAM_USE
public static final String PARAM_OPERATIONS
public static Jwk create(JsonObject json)
json - with definition of a web key (any key type)public String keyType()
PARAM_KEY_TYPE,
KEY_TYPE_EC,
KEY_TYPE_RSA,
KEY_TYPE_ECpublic String keyId()
PARAM_KEY_IDpublic String algorithm()
PARAM_ALGORITHMpublic Optional<String> usage()
PARAM_USE,
USE_ENCRYPTION,
USE_SIGNATUREpublic Optional<List<String>> operations()
public final boolean verifySignature(byte[] signedBytes,
byte[] signature)
signedBytes - bytes that are signed (e.g. content of a JWT, raw bytes)signature - signature bytes (raw bytes)public final byte[] sign(byte[] bytesToSign)
bytesToSign - byte to be signed (e.g. content of a JWT, raw bytes)Copyright © 2018, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.