java.lang.Object
javax.crypto.KeyGeneratorSpi
com.ibm.crypto.hdwrCCA.provider.DESedeKeyGenerator
This class generates a secret key for use with the Triple DES algorithm.
This documentation describes a Service Provider Interface. It is provided for implementation insight only. This class is not intended to be called directly by application developers. Please consult the 'Java Cryptography Architecture Standard' for details on how to use this interface through a public standard class.
- NOTE:
- Certain operations may require specific hardware or software, or specific key types. See the rest of this document and the z/OS Unique Considerations Hardware Crypto Reference Guide for more details. Unsupported operations and/or combinations may result in a RuntimeException Hardware Error.
javax.crypto.KeyGenerator
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected SecretKey
Generates and returns a Triple DES key.protected void
engineInit
(int keysize, SecureRandom random) Initializes this key generator for generating clear keys of a certain key size in bits, using the given source of randomness.protected void
engineInit
(SecureRandom random) Initializes this key generator with a source of randomness.protected void
engineInit
(AlgorithmParameterSpec params, SecureRandom random) Initializes this key generator with the specified parameter set and a user-provided source of randomness.
-
Constructor Details
-
DESedeKeyGenerator
public DESedeKeyGenerator()Verify the JCE framework in the constructor.- Throws:
SecurityException
- if fails to verify the JCE framework.
-
-
Method Details
-
engineInit
Initializes this key generator with a source of randomness. It is not valid to specify a source of randomness for a key that will be generated as a secret hardware key.- Specified by:
engineInit
in classKeyGeneratorSpi
- Parameters:
random
- the source of randomness for this generator
-
engineInit
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException Initializes this key generator with the specified parameter set and a user-provided source of randomness. If aCCAAlgorithmParameterSpec
is specified, and the requested key type is eitherCCAAlgorithmParameterSpec.SECURE_INTERNAL_TOKEN
orCCAAlgorithmParameterSpec.CKDS
, then the DESede key will be generated as a secret hardware key. Key generation parameters are validated, these validations include- Key size must be one of valid DESede key sizes.
- Hardware keys must use a supported key token wrapping mode.
- Hardware keys must have key usage of
SymmetricKeyConstants.KeyUsage.OP_DATA
,SymmetricKeyConstants.KeyUsage.OPEX_EXPORTER_IMPORTER
,SymmetricKeyConstants.KeyUsage.OPEX_IMPORTER_EXPORTER
, or null (default). - A key encrypting key must be provided if generating a key encrypting key pair.
- Specified by:
engineInit
in classKeyGeneratorSpi
- Parameters:
params
- the key generation parameters, clear key will be generated if the parameter is nullrandom
- the source of randomness for this key generator- Throws:
InvalidAlgorithmParameterException
- ifparams
is inappropriate for this key generator.InvalidParameterException
- if any of the key generation parameters fail validation.RuntimeException
- if the key wrapping mode specified by the key generation parameters is not supported by the current system.
-
engineInit
Initializes this key generator for generating clear keys of a certain key size in bits, using the given source of randomness.- Specified by:
engineInit
in classKeyGeneratorSpi
- Parameters:
keysize
- the size of the key to generate. This is an algorithm independent method of initialization. For Triple DES keys, a keysize with 112 bits of entropy corresponds to a Triple DES key with 2 intermediate keys, and a keysize with 168 bits of entropy corresponds to a Triple DES key with 3 intermediate keysrandom
- the source of randomness for this key generator- Throws:
InvalidParameterException
- if the specified key size is not valid.
-
engineGenerateKey
Generates and returns a Triple DES key.- Specified by:
engineGenerateKey
in classKeyGeneratorSpi
- Returns:
- the generated Triple DES secret key.
-