public class RSAKeyPairGeneratorFIPS extends RSAKeyPairGenerator
Note that setting the SecureRandom via initialize()
does not
have any effects, since FIPS-186-3 does not allow arbitrary PRNGs but only
NIST SP800-90 PRNGs.
For creating a RSA key pair, a KeyPairGenerator has to be instantiated,
properly initialized and directed to actually generate the keys by calling
the generateKeyPair
method. If the generator is
not initialized by explicitly calling an initialize
method, the
modulus length per default is set to 2048 bits.
Generating RSA keys using a modulus length of, e.g. 1024 bits, may be done by:
KeyPairGenerator key_gen = KeyPairGenerator.getIntance("RSA-FIPS-186-3"); key_gen.initialize(1024, sec_random); KeyPair key_pair = key_gen.generateKeyPair();
Guidelines on how to create some key using a KeyPairGenerator can be found in http://java.sun.com/products/JDK/1.2/docs/guide/security/CryptoSpec.html.
KeyPairGenerator
,
KeyPair
,
RSACipher
,
RSAPublicKey
,
RSAPrivateKey
,
RSAKeyFactory
Modifier and Type | Field and Description |
---|---|
static int |
KEYLENGTH_1024
Smallest keylength (1024 bits) supported by FIPS 186-3.
|
static int |
KEYLENGTH_2048
Medium keylength (2048 bits) supported by FIPS 186-3.
|
static int |
KEYLENGTH_3072
Largest keylength (3072 bits) supported by FIPS 186-3.
|
static java.math.BigInteger |
LOWER_PUBLIC_EXPONENT_BOUND
Lower bound for public exponent
|
static java.math.BigInteger |
UPPER_PUBLIC_EXPONENT_BOUND
Upper bound for public exponent
|
initialized, keylen, public_exponent, random
Constructor and Description |
---|
RSAKeyPairGeneratorFIPS()
Default constructor for creating a RSAKeyPairGenerator object.
|
generateKeyPair, initialize, initialize, initialize, initialize, initialize
public static final int KEYLENGTH_1024
public static final int KEYLENGTH_2048
public static final int KEYLENGTH_3072
public static final java.math.BigInteger LOWER_PUBLIC_EXPONENT_BOUND
public static final java.math.BigInteger UPPER_PUBLIC_EXPONENT_BOUND