- java.lang.Object
-
- java.security.KeyPairGeneratorSpi
-
- com.ibm.crypto.hdwrCCA.provider.DSAKeyPairGenerator
-
public class DSAKeyPairGenerator extends java.security.KeyPairGeneratorSpi
This class generates DSA public/private key pairs via hardware. An application can specify the size, the key label, the storage type, the key usage and the DSA parameters of the key pair to be generated via an instance of DSAHWKeyParametersSpec class. The default key is of size 512 with a random-generated label. Please note: that the storage type can only be encrypted outside the hardware device (KeyHWAttributeValues.PKDS) and the usage can only be signature only (KeyHWAttributeValues.Signature).
-
-
Constructor Summary
Constructors Constructor Description DSAKeyPairGenerator()
Constructs a new instance of this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.security.KeyPair
generateKeyPair()
Generates an DSA key pair via hardware.void
initialize(int keySize, java.security.SecureRandom random)
Initialize Key Pair Generator using the given secure random generator, and generate keys of a certain size.void
initialize(java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random)
Initialize Key Pair Generator using the given secure random generator, and generate keys from the provided set of parameters.
-
-
-
Method Detail
-
initialize
public void initialize(java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random) throws java.security.InvalidAlgorithmParameterException, java.security.InvalidParameterException
Initialize Key Pair Generator using the given secure random generator, and generate keys from the provided set of parameters.- Overrides:
initialize
in classjava.security.KeyPairGeneratorSpi
- Parameters:
params
- the parameter set to be used to generate the keys.random
- the source of randomness for this generator.- Throws:
java.security.InvalidAlgorithmParameterException
- is thrown if the params parameter is not an instance of DSAParameterSpec or DSAHWKeyParameterSpec.java.security.InvalidParameterException
- is thrown when key size of a DSAHWKeyParameterSpec parameter set is invalid.
-
initialize
public void initialize(int keySize, java.security.SecureRandom random) throws java.security.InvalidParameterException
Initialize Key Pair Generator using the given secure random generator, and generate keys of a certain size.- Specified by:
initialize
in classjava.security.KeyPairGeneratorSpi
- Parameters:
keySize
- new size of keys, in bits.random
- the source of randomness for this generator.- Throws:
java.security.InvalidParameterException
- is thrown when keySize is invalid.
-
generateKeyPair
public java.security.KeyPair generateKeyPair() throws java.lang.InternalError
Generates an DSA key pair via hardware. The public key is usable outside this provider. However, the private key is stored in a hardware associated file(PKDS) and is therefore only useable by this provider on the machine that generated the key pair.- Specified by:
generateKeyPair
in classjava.security.KeyPairGeneratorSpi
- Returns:
- a newly generated DSA key pair.
- Throws:
java.lang.InternalError
- is thrown when an unexpected error occurs.
-
-