Package com.nimbusds.jose.jwk.gen
Class RSAKeyGenerator
- java.lang.Object
-
- com.nimbusds.jose.jwk.gen.JWKGenerator<RSAKey>
-
- com.nimbusds.jose.jwk.gen.RSAKeyGenerator
-
public class RSAKeyGenerator extends JWKGenerator<RSAKey>
RSA JSON Web Key (JWK) generator.- Version:
- 2023-01-29
- Author:
- Vladimir Dzhuvinov, Justin Cranford
-
-
Field Summary
Fields Modifier and Type Field Description static int
MIN_KEY_SIZE_BITS
The minimum size of generated keys.
-
Constructor Summary
Constructors Constructor Description RSAKeyGenerator(int size)
Creates a new RSA JWK generator.RSAKeyGenerator(int size, boolean allowWeakKeys)
Creates a new RSA JWK generator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RSAKey
generate()
Generates the JWK according to the set parameters.-
Methods inherited from class com.nimbusds.jose.jwk.gen.JWKGenerator
algorithm, expirationTime, issueTime, keyID, keyIDFromThumbprint, keyOperations, keyStore, keyUse, notBeforeTime, provider, secureRandom
-
-
-
-
Field Detail
-
MIN_KEY_SIZE_BITS
public static final int MIN_KEY_SIZE_BITS
The minimum size of generated keys.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RSAKeyGenerator
public RSAKeyGenerator(int size)
Creates a new RSA JWK generator.- Parameters:
size
- The RSA key size, in bits. Must be at least 2048 bits long for sufficient strength.
-
RSAKeyGenerator
public RSAKeyGenerator(int size, boolean allowWeakKeys)
Creates a new RSA JWK generator.- Parameters:
size
- The RSA key size, in bits. Must be at least 2048 bits long for sufficient strength.allowWeakKeys
-true
to allow generation of keys shorter than 2048 bits.
-
-
Method Detail
-
generate
public RSAKey generate() throws JOSEException
Description copied from class:JWKGenerator
Generates the JWK according to the set parameters.- Specified by:
generate
in classJWKGenerator<RSAKey>
- Returns:
- The generated JWK.
- Throws:
JOSEException
- If the key generation failed.
-
-