de.flexiprovider.core.pbe
Class PBEKeyFactory
java.lang.Object
|
+--javax.crypto.SecretKeyFactorySpi
|
+--de.flexiprovider.api.keys.SecretKeyFactory
|
+--de.flexiprovider.core.pbe.interfaces.PBEKeyFactory
|
+--de.flexiprovider.core.pbe.PBEKeyFactory
- public class PBEKeyFactory
- extends PBEKeyFactory
This class represents a factory for secret keys. This class is used to
convert PBE keys into a format usable by the FlexiProvider and its intended
use is for PBE according to PKCS #5, e.g. PbeWithSHAAnd3_KeyTripleDES_CBC.
Currently, this class can only convert from a KeySpec into a Key. The
supported KeySpec class is PBEKeySpec.
This class should not be instantiated directly, instead use the
java.security.KeyFactory interface.
- Author:
- Michele Boivin
|
Method Summary |
SecretKey |
generateSecret(KeySpec keySpec)
Generate a PBE SecretKey object from the provided key specification (key
material). |
KeySpec |
getKeySpec(SecretKey key,
java.lang.Class keySpec)
Return a specification (key material) of the given key object in the
requested format. |
SecretKey |
translateKey(SecretKey key)
Translate a PBE key object, whose provider may be unknown or potentially
untrusted, into a corresponding key object of this key factory. |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PBEKeyFactory
public PBEKeyFactory()
generateSecret
public final SecretKey generateSecret(KeySpec keySpec)
throws InvalidKeySpecException
- Generate a PBE SecretKey object from the provided key specification (key
material).
- Overrides:
generateSecret in class SecretKeyFactory
- Parameters:
keySpec - the specification (key material) of the secret key- Returns:
- The secret key.
- Throws:
InvalidKeySpecException - if the given key specification is inappropriate for this
secret-key factory to produce a secret key.
getKeySpec
public final KeySpec getKeySpec(SecretKey key,
java.lang.Class keySpec)
throws InvalidKeySpecException
- Return a specification (key material) of the given key object in the
requested format.
- Overrides:
getKeySpec in class SecretKeyFactory
- Parameters:
key - the keykeySpec - the requested format in which the key material shall be
returned- Returns:
- the underlying key specification (key material) in the requested
format
- Throws:
InvalidKeySpecException - if the requested key specification is inappropriate for
the given key, or the given key cannot be dealt with
(e.g., the given key has an unrecognised format).
translateKey
public final SecretKey translateKey(SecretKey key)
throws InvalidKeyException
- Translate a PBE key object, whose provider may be unknown or potentially
untrusted, into a corresponding key object of this key factory. Not
currently implemented.
- Overrides:
translateKey in class SecretKeyFactory
- Parameters:
key - the key whose provider is unknown or untrusted- Returns:
- the translated key
- Throws:
InvalidKeyException - if the given key cannot be processed by this key factory.