de.flexiprovider.core.rsa
Class RSAKeyPairGenerator

java.lang.Object
  |
  +--java.security.KeyPairGeneratorSpi
        |
        +--de.flexiprovider.api.keys.KeyPairGenerator
              |
              +--de.flexiprovider.core.rsa.interfaces.RSAKeyPairGenerator
                    |
                    +--de.flexiprovider.core.rsa.RSAKeyPairGenerator

public final class RSAKeyPairGenerator
extends RSAKeyPairGenerator

This class extends the KeyPairGenerator class. The key generation follows the PKCS#1 standard. The algorithm strength translates directly to the bit length of the modulus n = p*q. A key pair consists of an RSAPublicKey and an RSAPrivateCrtKey. The default bit length of n is 1024.

Author:
Thomas Wahrenbruch, Martin Döring

Constructor Summary
RSAKeyPairGenerator()
           
 
Method Summary
 KeyPair genKeyPair()
          Generate an RSA key pair.
 void initialize(AlgorithmParameterSpec params, SecureRandom random)
          Initialize the key pair generator with the given parameters and source of randomness.
 void initialize(int keySize, SecureRandom random)
          Initialize the key pair generator with the given key size.
 
Methods inherited from class de.flexiprovider.core.rsa.interfaces.RSAKeyPairGenerator
initialize
 
Methods inherited from class de.flexiprovider.api.keys.KeyPairGenerator
generateKeyPair, initialize
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RSAKeyPairGenerator

public RSAKeyPairGenerator()
Method Detail

initialize

public void initialize(AlgorithmParameterSpec params,
                       SecureRandom random)
                throws InvalidAlgorithmParameterException
Initialize the key pair generator with the given parameters and source of randomness. If the parameters are null, the default parameters are used.
Overrides:
initialize in class KeyPairGenerator
Parameters:
params - the key generation parameters
random - the source of randomness
Throws:
InvalidAlgorithmParameterException - if the parameters are not an instance of RSAKeyGenParameterSpec.

initialize

public void initialize(int keySize,
                       SecureRandom random)
Initialize the key pair generator with the given key size.
Overrides:
initialize in class KeyPairGenerator
Parameters:
keySize - the bit length of the modulus n
random - the source of randomness

genKeyPair

public KeyPair genKeyPair()
Generate an RSA key pair.
Overrides:
genKeyPair in class KeyPairGenerator
Returns:
the key pair, consisting of an RSAPrivateCrtKey and an RSAPublicKey