cryptix.provider.rsa
public class BaseRSAKeyPairGenerator extends KeyPairGenerator implements RSAKeyPairGenerator
Users wishing to indicate the public exponent, and to generate a key pair suitable for use with the RSA algorithm typically:
Note: To use this generator in your configuration, make sure that the following property is set in the Cryptix.properties file (located in the cryptix-lib directory):
KeyPairGenerator.RSA = cryptix.provider.rsa.BaseRSAKeyPairGenerator
The algorithm used to generate RSA keys is that described in [1], adapted for our case where e is known in advance:
For the prime number generation, we use java.math.BigInteger class
methods and constructors which rely (as of JDK 1.1 and up to the time
of this writing) on Colin Plumb's
BigNum multi-precision integer math library. It is not clear
though what part of this library is called (by the plumbGeneratePrime
native method) for the actual probable prime generation.
The BigInteger class also uses the Miller-Rabin probabilistic primality
test, also known as strong pseudo prime test as described in
FIPS-186, with a user supplied certainty factor, referred to in
the source as isProbablePrime
. In this implementation we provide
a default value of 80 for this parameter. In future revisions we
will refine the computations to set this parameter, depending on the
strength of the desired prime, using a function to compute an upperbound
limit on the Miller-Rabin test error probability.
References:
Copyright © 1997
Systemics Ltd on behalf of the
Cryptix Development Team.
All rights reserved.
$Revision: 1.9 $
See Also: java.security.KeyPairGenerator
Constructor Summary | |
---|---|
BaseRSAKeyPairGenerator() |
Method Summary | |
---|---|
KeyPair | generateKeyPair()
Generate a new RSA key pair with the confidence that each of the
public modulus n factors p and q are primes
with a mathematical probability that will exceed 1 - (1/2)**
CONFIDENCE. |
void | initialize(int strength, BigInteger e, SecureRandom source)
Initialise the key pair generator using the specified strength
(desired public modulus length in bits), public exponent, and a
source of random bits.
|
void | initialize(int strength, SecureRandom source)
Initialise the RSA key pair generator for a given key strength
(its number of bits), using the Fermat prime F4 (0x10001) as the
public exponent.
|
void | initialize()
Initialise the RSA key pair generator for key strength value of
1024-bit, using the Fermat prime F4 (0x10001) as the encryption/
decryption exponent and a default SecureRandom source. |
protected KeyPair | makeKeyPair(BigInteger n, BigInteger e, BigInteger d, BigInteger p, BigInteger q) Makes an RSA key pair using the given parameters. |
Parameters: strength desired number of bits in the public modulus to be generated by this object. If null or less than 2 then use the set DEFAULT_STRENGTH e the encryption/decryption exponent. If null then use Fermat's F4 prime. source a cryptographically strong source of pseudo random data. If null then use a default one.
Parameters: strength desired number of bits in the public modulus to be generated by this object. source a cryptographically strong source of pseudo random data.