com.ibm.crypto.hdwrCCA.provider
Class RSAKeyPairGenerator
- java.lang.Object
-
- java.security.KeyPairGeneratorSpi
-
- java.security.KeyPairGenerator
-
- com.ibm.crypto.hdwrCCA.provider.RSAKeyPairGenerator
-
public final class RSAKeyPairGenerator extends java.security.KeyPairGeneratorThis class generates RSA public/private key pairs via hardware. An application can specify the size, the key label, the storage type and usage type of the key pair to be generated via an instance of the RSAKeyParametersSpec class. The default key is of size 1024 with a random-generated label, stored encrypted outside the hardware device (KeyHWAttributeValues.PKDS) with a usage of signature only (KeyHWAttributeValues.Signature).
-
-
Constructor Summary
Constructors Constructor and Description RSAKeyPairGenerator()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 an RSA key pair via hardware.voidinitialize(java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random)Initializes this KeyPairGenerator for given parameters and secure random source.voidinitialize(int strength, java.security.SecureRandom random)Initializes this KeyPairGenerator for given modulus size and secure random source.
-
-
-
Constructor Detail
-
RSAKeyPairGenerator
public RSAKeyPairGenerator()
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.InvalidAlgorithmParameterException, java.security.InvalidParameterExceptionInitializes this KeyPairGenerator for given parameters and secure random source.- Overrides:
initializein classjava.security.KeyPairGenerator- Parameters:
params- the RSAKeyParameterSpec for this object.random- the SecureRandom object for generating random numbers.- Throws:
java.security.InvalidAlgorithmParameterException- thrown when parameter set is not recognized.java.security.InvalidParameterException
-
initialize
public void initialize(int strength, java.security.SecureRandom random) throws java.security.InvalidParameterExceptionInitializes this KeyPairGenerator for given modulus size and secure random source. The private key will be stored in the CLEAR not the hardware or the PKDS, the private key label will be randomly generated and the key will be used for signing purposes.- Overrides:
initializein classjava.security.KeyPairGenerator- Parameters:
strength- the length of the key to be generated.random- the SecureRandom object for generating a random number.- Throws:
java.security.InvalidParameterException- thrown when a parameter is not recognized.
-
generateKeyPair
public java.security.KeyPair generateKeyPair()
Generates an RSA key pair via hardware. The public key is usable outside this provider. However, the private key is stored in the hardware(RETAIN) or a hardware associated file (PKDS) or as a clear token representaion (CLEAR) and is therefore only useable by this provider on the machine that generated the key pair.- Overrides:
generateKeyPairin classjava.security.KeyPairGenerator- Returns:
- a KeyPair contains a pair of generated RSA keys
- Throws:
java.lang.IllegalArgumentException- in the key label formal is not valid
-
-