com.ibm.crypto.pkcs11impl.provider
Class RSAPKCS11KeyPairGenerator
- java.lang.Object
-
- java.security.KeyPairGeneratorSpi
-
- com.ibm.crypto.pkcs11impl.provider.RSAPKCS11KeyPairGenerator
-
public final class RSAPKCS11KeyPairGenerator extends java.security.KeyPairGeneratorSpiThis class generates RSA public/private key pairs. Note: There is a very small chance that an ArithmeticException being thrown during generateKeyPair().
-
-
Constructor Summary
Constructors Constructor and Description RSAPKCS11KeyPairGenerator()Creates a new instance of this class.RSAPKCS11KeyPairGenerator(java.security.Provider provider)Creates a new instance of this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.security.KeyPairgenerateKeyPair()Generates a Key Pairvoidinitialize(java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random)RSAPKCS11KeyPairGenerator requires Algorithm Parameters of type PKCS11RSAKeyPairParametervoidinitialize(int strength)Initializes this KeyPairGenerator for given modulus.voidinitialize(int strength, java.security.SecureRandom random)Initializes this KeyPairGenerator for given modulus and random source.
-
-
-
Constructor Detail
-
RSAPKCS11KeyPairGenerator
public RSAPKCS11KeyPairGenerator(java.security.Provider provider)
Creates a new instance of this class.
-
RSAPKCS11KeyPairGenerator
public RSAPKCS11KeyPairGenerator()
Creates a new instance of this class.
-
-
Method Detail
-
initialize
public void initialize(java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random) throws java.security.InvalidAlgorithmParameterExceptionRSAPKCS11KeyPairGenerator requires Algorithm Parameters of type PKCS11RSAKeyPairParameter- Overrides:
initializein classjava.security.KeyPairGeneratorSpi- Parameters:
params- Algorithm Parameters of type PKCS11RSAKeyPairParameterrandom- which is not used and can be set to null.- Throws:
java.security.InvalidAlgorithmParameterException- is thrown if params is null or not an instance of PKCS11RSAKeyPairParameter
-
initialize
public void initialize(int strength, java.security.SecureRandom random)Initializes this KeyPairGenerator for given modulus and random source.- Specified by:
initializein classjava.security.KeyPairGeneratorSpi- Parameters:
strength- is the size of the modulu.random- which is not used and can be set to null.- Throws:
java.security.InvalidParameterException- ifstrengthis invalid
-
initialize
public void initialize(int strength)
Initializes this KeyPairGenerator for given modulus.- Parameters:
strength- is the size of the modulu.- Throws:
java.security.InvalidParameterException- ifstrengthis invalid
-
generateKeyPair
public java.security.KeyPair generateKeyPair()
Generates a Key Pair- Specified by:
generateKeyPairin classjava.security.KeyPairGeneratorSpi- Returns:
- a KeyPair contains a pair of generated RSA keys Note: There is a very small chance (1/1000) that an ArithmeticException being thrown during generateKeyPair(). In that case, calling generateKeyPair() again will give a new pair of keys.
-
-