Class DESKeyGenerator


  • public final class DESKeyGenerator
    extends javax.crypto.KeyGeneratorSpi
    This class generates a DES key.

    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.
    For public interface details, consult the JCE API documentation for javax.crypto.KeyGenerator.
    • Constructor Summary

      Constructors 
      Constructor Description
      DESKeyGenerator()
      Verify the JCE framework in the constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected javax.crypto.SecretKey engineGenerateKey()
      Generates the DES key.
      protected void engineInit​(int keysize, java.security.SecureRandom random)
      Initializes this key generator for a certain keysize, using the given source of randomness.
      protected void engineInit​(java.security.SecureRandom random)
      Initializes this key generator with a source of randomness.
      protected void engineInit​(java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random)
      Initializes this key generator with the specified parameter set and a user-provided source of randomness.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DESKeyGenerator

        public DESKeyGenerator()
        Verify the JCE framework in the constructor.
        Throws:
        java.lang.SecurityException - if fails to verify the JCE framework.
    • Method Detail

      • engineInit

        protected void engineInit​(java.security.SecureRandom random)
        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 class javax.crypto.KeyGeneratorSpi
        Parameters:
        random - the source of randomness for this generator
      • engineInit

        protected void engineInit​(java.security.spec.AlgorithmParameterSpec params,
                                  java.security.SecureRandom random)
                           throws java.security.InvalidAlgorithmParameterException
        Initializes this key generator with the specified parameter set and a user-provided source of randomness. If a CCAAlgorithmParameterSpec is specified, and the requested key type is either CCAAlgorithmParameterSpec.SECURE_INTERNAL_TOKEN or CCAAlgorithmParameterSpec.CKDS, then the DES key will be generated as a secret hardware key. Generation of key encrypting keys is not supported.
        Specified by:
        engineInit in class javax.crypto.KeyGeneratorSpi
        Parameters:
        params - the key generation parameters
        random - the source of randomness for this key generator
        Throws:
        java.security.InvalidAlgorithmParameterException - if params is inappropriate for this key generator.
        java.security.InvalidParameterException - if the key size in the key generation parameters is not valid.
      • engineInit

        protected void engineInit​(int keysize,
                                  java.security.SecureRandom random)
        Initializes this key generator for a certain keysize, using the given source of randomness.
        Specified by:
        engineInit in class javax.crypto.KeyGeneratorSpi
        Parameters:
        keysize - the keysize. This is an algorithm-specific metric specified in number of bits
        random - the source of randomness for this key generator
        Throws:
        java.security.InvalidParameterException - if the specified key size is not valid.
      • engineGenerateKey

        protected javax.crypto.SecretKey engineGenerateKey()
        Generates the DES key.
        Specified by:
        engineGenerateKey in class javax.crypto.KeyGeneratorSpi
        Returns:
        the new DES key.