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 com.nimbusds.jose.jwk.JWKMatcher |
HMAC_SHA256_KEY_MATCHER
JWK matcher for the 256 bit HMAC SHA key with key ID "hmac".
|
static int |
REFRESH_TOKEN_AES_SIV_KEY_BIT_SIZE
The refresh token AES SIV key bit size.
|
static com.nimbusds.jose.jwk.JWKMatcher |
REFRESH_TOKEN_ENCRYPTION_KEY_MATCHER
JWK matcher for the 256 bit refresh token encryption key (intended
for AES SIV mode) with key ID "refresh-token-encrypt".
|
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.
|
static com.nimbusds.jose.jwk.JWKMatcher |
SUBJECT_ENCRYPTION_KEY_MATCHER
JWK matcher for the 256 bit subject encryption key (intended for AES
SIV mode) with key ID "subject-encrypt".
|
| Constructor and Description |
|---|
JWKSetGenerator() |
| Modifier and Type | Method and Description |
|---|---|
com.nimbusds.jose.jwk.JWKSet |
generate(Consumer<String> eventMessageSink)
Generates a new JWK set for a Connect2id server.
|
com.nimbusds.jose.jwk.JWKSet |
generateAndPrefixNewKeys(com.nimbusds.jose.jwk.JWKSet oldJWKSet,
Consumer<String> eventMessageSink)
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> |
generateMissingPermanentKeys(com.nimbusds.jose.jwk.JWKSet jwkSet,
Consumer<String> eventMessageSink)
Generates the missing permanent keys for a Connect2id server not
found in the specified JWK set.
|
List<com.nimbusds.jose.jwk.JWK> |
generatePermanentKeys(Consumer<String> eventMessageSink)
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,
Consumer<String> eventMessageSink)
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 final com.nimbusds.jose.jwk.JWKMatcher HMAC_SHA256_KEY_MATCHER
public static final com.nimbusds.jose.jwk.JWKMatcher SUBJECT_ENCRYPTION_KEY_MATCHER
public static final com.nimbusds.jose.jwk.JWKMatcher REFRESH_TOKEN_ENCRYPTION_KEY_MATCHER
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, Consumer<String> eventMessageSink) throws com.nimbusds.jose.JOSEException
reservedKeyIDs - The reserved key IDs, empty if none.eventMessageSink - Optional sink for event messages,
null if not specified.com.nimbusds.jose.JOSEExceptionpublic List<com.nimbusds.jose.jwk.JWK> generatePermanentKeys(Consumer<String> eventMessageSink) throws com.nimbusds.jose.JOSEException
eventMessageSink - Optional sink for event messages,
null if not specified.com.nimbusds.jose.JOSEExceptionpublic List<com.nimbusds.jose.jwk.JWK> generateMissingPermanentKeys(com.nimbusds.jose.jwk.JWKSet jwkSet, Consumer<String> eventMessageSink) throws com.nimbusds.jose.JOSEException
jwkSet - The JWK set.eventMessageSink - Optional sink for event messages,
null if not specified.com.nimbusds.jose.JOSEExceptionpublic com.nimbusds.jose.jwk.JWKSet generate(Consumer<String> eventMessageSink) throws com.nimbusds.jose.JOSEException
eventMessageSink - Optional sink for event messages,
null if not specified.com.nimbusds.jose.JOSEExceptionpublic com.nimbusds.jose.jwk.JWKSet generateAndPrefixNewKeys(com.nimbusds.jose.jwk.JWKSet oldJWKSet,
Consumer<String> eventMessageSink)
throws Exception
oldJWKSet - The Connect2id server JWK set. Must not be
null.eventMessageSink - Optional sink for event messages,
null if not specified.Exceptionpublic static void main(String[] args)
args - The command line arguments.Copyright © 2021 Connect2id Ltd.. All rights reserved.