Package java.security
Class KeyFactorySpi
java.lang.Object
java.security.KeyFactorySpi
- Direct Known Subclasses:
BaseKeyFactorySpi,DSAKeyFactoryImpl,KeyFactory,OpenSSLDSAKeyFactory,OpenSSLECKeyFactory,OpenSSLRSAKeyFactory
public abstract class KeyFactorySpi extends Object
KeyFactorySpi is the Service Provider Interface (SPI) definition for
KeyFactory.- See Also:
KeyFactory
-
Constructor Summary
Constructors Constructor Description KeyFactorySpi() -
Method Summary
Modifier and Type Method Description protected abstract PrivateKeyengineGeneratePrivate(KeySpec keySpec)Generates a instance ofPrivateKeyfrom the given key specification.protected abstract PublicKeyengineGeneratePublic(KeySpec keySpec)Generates a instance ofPublicKeyfrom the given key specification.protected abstract <T extends KeySpec>
TengineGetKeySpec(Key key, Class<T> keySpec)Returns the key specification for the specified key.protected abstract KeyengineTranslateKey(Key key)Translates the given key into a key from this key factory.
-
Constructor Details
-
KeyFactorySpi
public KeyFactorySpi()
-
-
Method Details
-
engineGeneratePublic
Generates a instance ofPublicKeyfrom the given key specification.- Parameters:
keySpec- the specification of the public key.- Returns:
- the public key.
- Throws:
InvalidKeySpecException- if the specifiedkeySpecis invalid.
-
engineGeneratePrivate
protected abstract PrivateKey engineGeneratePrivate(KeySpec keySpec) throws InvalidKeySpecExceptionGenerates a instance ofPrivateKeyfrom the given key specification.- Parameters:
keySpec- the specification of the private key.- Returns:
- the private key.
- Throws:
InvalidKeySpecException- if the specifiedkeySpecis invalid.
-
engineGetKeySpec
protected abstract <T extends KeySpec> T engineGetKeySpec(Key key, Class<T> keySpec) throws InvalidKeySpecExceptionReturns the key specification for the specified key.- Parameters:
key- the key from which the specification is requested.keySpec- the type of the requestedKeySpec.- Returns:
- the key specification for the specified key.
- Throws:
InvalidKeySpecException- if the key can not be processed, or the requested requestedKeySpecis inappropriate for the given key.
-
engineTranslateKey
Translates the given key into a key from this key factory.- Parameters:
key- the key to translate.- Returns:
- the translated key.
- Throws:
InvalidKeyException- if the specified key can not be translated by this key factory.
-