public class JWKSetGenerator extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
AES_KEY_BIT_SIZE
The AES key bit size.
|
static int |
HMAC_SHA_KEY_BIT_SIZE
The HMAC SHA key bit size.
|
static int |
REFRESH_TOKEN_AES_SIV_KEY_BIT_SIZE
The refresh token AES SIV key bit size.
|
static int |
RSA_KEY_BIT_SIZE
The RSA key bit size.
|
static int |
SUBJECT_AES_SIV_KEY_BIT_SIZE
The subject AES SIV key bit size.
|
| Constructor and Description |
|---|
JWKSetGenerator() |
| Modifier and Type | Method and Description |
|---|---|
com.nimbusds.jose.jwk.JWKSet |
generate(boolean withMessage)
Generates a new JWK set for a Connect2id server.
|
com.nimbusds.jose.jwk.JWKSet |
generateAndPrefixNewKeys(com.nimbusds.jose.jwk.JWKSet oldJWKSet,
boolean withMessage)
A generates a new set of signing and encryption keys and prefixes
them to the specified Connect2id server JWK set.
|
static com.nimbusds.jose.jwk.OctetSequenceKey |
generateEncryptionAESKey(String kid)
Generates a 128 bit AES encryption key with the specified key ID.
|
static com.nimbusds.jose.jwk.ECKey |
generateEncryptionECKey(com.nimbusds.jose.jwk.Curve crv,
String kid)
Generates an EC encryption key with the specified curve and key ID.
|
static com.nimbusds.jose.jwk.RSAKey |
generateEncryptionRSAKey(String kid)
Generates a 2048 bit RSA encryption key with the specified key ID.
|
static com.nimbusds.jose.jwk.OctetSequenceKey |
generateHMACSHA256Key()
Generates a 256 bit HMAC SHA key with key ID "hmac".
|
List<com.nimbusds.jose.jwk.JWK> |
generatePermanentKeys(boolean withMessage)
Generates a new set of permanent keys for a Connect2id server.
|
static com.nimbusds.jose.jwk.OctetSequenceKey |
generateRefreshTokenEncryptionKey()
Generates a 256 bit refresh token encryption key (intended for AES
SIV mode) with key ID "refresh-token-encrypt".
|
List<com.nimbusds.jose.jwk.JWK> |
generateRotatingKeys(KeyIDs reservedKeyIDs,
boolean withMessage)
Generates a new set of rotating signature and encryption keys for a
Connect2id server.
|
static com.nimbusds.jose.jwk.ECKey |
generateSigningECKey(com.nimbusds.jose.jwk.Curve crv,
String kid)
Generates an EC signing key with the specified curve and key ID.
|
static com.nimbusds.jose.jwk.OctetKeyPair |
generateSigningEd25519Key(String kid)
Generates an Ed25519 signing key with the specified key ID.
|
static com.nimbusds.jose.jwk.RSAKey |
generateSigningRSAKey(String kid)
Generates a 2048 bit RSA signing key with the specified key ID.
|
static com.nimbusds.jose.jwk.OctetSequenceKey |
generateSubjectEncryptionKey()
Generates a 256 bit subject encryption key (intended for AES SIV
mode) with key ID "subject-encrypt".
|
static void |
main(String[] args)
Console method for generating a new Connect2id server JWK set, or
updating an existing JWK set with new signing and encryption keys.
|
public static final int RSA_KEY_BIT_SIZE
public static final int AES_KEY_BIT_SIZE
public static final int HMAC_SHA_KEY_BIT_SIZE
public static final int SUBJECT_AES_SIV_KEY_BIT_SIZE
public static final int REFRESH_TOKEN_AES_SIV_KEY_BIT_SIZE
public static com.nimbusds.jose.jwk.RSAKey generateSigningRSAKey(String kid) throws com.nimbusds.jose.JOSEException
kid - The key ID, null if not specified.com.nimbusds.jose.JOSEExceptionpublic static com.nimbusds.jose.jwk.RSAKey generateEncryptionRSAKey(String kid) throws com.nimbusds.jose.JOSEException
kid - The key ID, null if not specified.com.nimbusds.jose.JOSEExceptionpublic static com.nimbusds.jose.jwk.ECKey generateSigningECKey(com.nimbusds.jose.jwk.Curve crv,
String kid)
throws com.nimbusds.jose.JOSEException
crv - The curve. Must not be null.kid - The key ID, null if not specified.com.nimbusds.jose.JOSEExceptionpublic static com.nimbusds.jose.jwk.ECKey generateEncryptionECKey(com.nimbusds.jose.jwk.Curve crv,
String kid)
throws com.nimbusds.jose.JOSEException
crv - The curve. Must not be null.kid - The key ID, null if not specified.com.nimbusds.jose.JOSEExceptionpublic static com.nimbusds.jose.jwk.OctetKeyPair generateSigningEd25519Key(String kid) throws com.nimbusds.jose.JOSEException
kid - The key ID, null if not specified.com.nimbusds.jose.JOSEExceptionpublic static com.nimbusds.jose.jwk.OctetSequenceKey generateEncryptionAESKey(String kid) throws com.nimbusds.jose.JOSEException
kid - The key ID, null if not specified.com.nimbusds.jose.JOSEExceptionpublic static com.nimbusds.jose.jwk.OctetSequenceKey generateHMACSHA256Key()
throws com.nimbusds.jose.JOSEException
com.nimbusds.jose.JOSEExceptionpublic static com.nimbusds.jose.jwk.OctetSequenceKey generateSubjectEncryptionKey()
throws com.nimbusds.jose.JOSEException
com.nimbusds.jose.JOSEExceptionpublic static com.nimbusds.jose.jwk.OctetSequenceKey generateRefreshTokenEncryptionKey()
throws com.nimbusds.jose.JOSEException
com.nimbusds.jose.JOSEExceptionpublic List<com.nimbusds.jose.jwk.JWK> generateRotatingKeys(KeyIDs reservedKeyIDs, boolean withMessage) throws com.nimbusds.jose.JOSEException
reservedKeyIDs - The reserved key IDs, empty if none.withMessage - If true a message will be printed to
standard output.com.nimbusds.jose.JOSEExceptionpublic List<com.nimbusds.jose.jwk.JWK> generatePermanentKeys(boolean withMessage) throws com.nimbusds.jose.JOSEException
withMessage - If true a message will be printed to
standard output.com.nimbusds.jose.JOSEExceptionpublic com.nimbusds.jose.jwk.JWKSet generate(boolean withMessage)
throws com.nimbusds.jose.JOSEException
withMessage - If true a message will be printed to
standard output.com.nimbusds.jose.JOSEExceptionpublic com.nimbusds.jose.jwk.JWKSet generateAndPrefixNewKeys(com.nimbusds.jose.jwk.JWKSet oldJWKSet,
boolean withMessage)
throws Exception
oldJWKSet - The Connect2id server JWK set. Must not be
null.withMessage - If true a message will be printed to std
output.Exceptionpublic static void main(String[] args)
args - The command line arguments.Copyright © 2020 Connect2id Ltd.. All rights reserved.