Package javax.crypto

Class SecretKeyFactorySpi

java.lang.Object
javax.crypto.SecretKeyFactorySpi
Direct Known Subclasses:
BaseSecretKeyFactory

public abstract class SecretKeyFactorySpi
extends Object
The Service Provider Interface (SPI) definition for the SecretKeyFactory class.
  • Constructor Details

    • SecretKeyFactorySpi

      public SecretKeyFactorySpi()
      Creates a new SecretKeyFactorySpi instance.
  • Method Details

    • engineGenerateSecret

      protected abstract SecretKey engineGenerateSecret​(KeySpec keySpec) throws InvalidKeySpecException
      Generate a secret key from the specified key specification.
      Parameters:
      keySpec - the key specification.
      Returns:
      a secret key.
      Throws:
      InvalidKeySpecException - if the specified key specification cannot be used to generate a secret key.
    • engineGetKeySpec

      protected abstract KeySpec engineGetKeySpec​(SecretKey key, Class keySpec) throws InvalidKeySpecException
      Returns the key specification of the specified secret key.
      Parameters:
      key - the secret key to get the specification from.
      keySpec - the target key specification class.
      Returns:
      an instance of the specified key specification class.
      Throws:
      InvalidKeySpecException - if the specified secret key cannot be transformed into the requested key specification.
    • engineTranslateKey

      protected abstract SecretKey engineTranslateKey​(SecretKey key) throws InvalidKeyException
      Translates the specified secret key into an instance of the corresponding key from the provider of this key factory.
      Parameters:
      key - the secret key to translate.
      Returns:
      the corresponding translated key.
      Throws:
      InvalidKeyException - if the specified key cannot be translated using this key factory.