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 Summary
Constructors Constructor Description SecretKeyFactorySpi()Creates a newSecretKeyFactorySpiinstance. -
Method Summary
Modifier and Type Method Description protected abstract SecretKeyengineGenerateSecret(KeySpec keySpec)Generate a secret key from the specified key specification.protected abstract KeySpecengineGetKeySpec(SecretKey key, Class keySpec)Returns the key specification of the specified secret key.protected abstract SecretKeyengineTranslateKey(SecretKey key)Translates the specified secret key into an instance of the corresponding key from the provider of this key factory.
-
Constructor Details
-
SecretKeyFactorySpi
public SecretKeyFactorySpi()Creates a newSecretKeyFactorySpiinstance.
-
-
Method Details
-
engineGenerateSecret
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 InvalidKeySpecExceptionReturns 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
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.
-