|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.security.KeyPairGeneratorSpi | +--java.security.KeyPairGenerator | +--cryptix.provider.rsa.BaseRSAKeyPairGenerator
A class capable of generating RSA key pairs. The generator is first initialized, then used to generate one or more RSA key pairs.
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 $
KeyPairGenerator
Inner classes inherited from class java.security.KeyPairGenerator |
java.security.KeyPairGenerator.Delegate |
Constructor Summary | |
BaseRSAKeyPairGenerator()
|
Method Summary | |
java.security.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()
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. |
void |
initialize(int strength,
java.math.BigInteger e,
java.security.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,
java.security.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. |
protected java.security.KeyPair |
makeKeyPair(java.math.BigInteger n,
java.math.BigInteger e,
java.math.BigInteger d,
java.math.BigInteger p,
java.math.BigInteger q)
Makes an RSA key pair using the given parameters. |
Methods inherited from class java.security.KeyPairGenerator |
genKeyPair, getAlgorithm, getInstance, getInstance, getProvider, initialize, initialize, initialize |
Methods inherited from class java.lang.Object |
|
Constructor Detail |
public BaseRSAKeyPairGenerator()
Method Detail |
public void initialize(int strength, java.math.BigInteger e, java.security.SecureRandom source)
initialize
in interface RSAKeyPairGenerator
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_STRENGTHe
- 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.public void initialize(int strength, java.security.SecureRandom source)
initialize
in class java.security.KeyPairGenerator
strength
- desired number of bits in the public modulus
to be generated by this object.source
- a cryptographically strong source of pseudo
random data.public java.security.KeyPair generateKeyPair()
generateKeyPair
in class java.security.KeyPairGenerator
protected java.security.KeyPair makeKeyPair(java.math.BigInteger n, java.math.BigInteger e, java.math.BigInteger d, java.math.BigInteger p, java.math.BigInteger q)
public void initialize()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |