de.flexiprovider.core.shacal2
Class Shacal2KeyFactory

java.lang.Object
  |
  +--javax.crypto.SecretKeyFactorySpi
        |
        +--de.flexiprovider.api.keys.SecretKeyFactory
              |
              +--de.flexiprovider.core.shacal2.Shacal2KeyFactory

public final class Shacal2KeyFactory
extends SecretKeyFactory

This class represents a factory for secret keys. This class is used to convert Shacal2 keys into a format usable by the CDC provider. The supported KeySpec class is Shacal2KeySpec.

This class should not be instantiated directly, instead use the java.security.KeyFactory interface.

Author:
Paul Nguentcheu
See Also:
SecretKeyFactory

Constructor Summary
Shacal2KeyFactory()
           
 
Method Summary
 SecretKey generateSecret(KeySpec keySpec)
          Generate a Shacal2 key object from the provided key specification.
 KeySpec getKeySpec(SecretKey key, java.lang.Class keySpec)
          Return a key specification of the given key object in the requested format.
 SecretKey translateKey(SecretKey key)
          Translates a Shacal2 key object, whose provider may be unknown or potentially untrusted, into a corresponding key object of this key factory.
 
Methods inherited from class de.flexiprovider.api.keys.SecretKeyFactory
engineGenerateSecret, engineGetKeySpec, engineTranslateKey
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Shacal2KeyFactory

public Shacal2KeyFactory()
Method Detail

generateSecret

public SecretKey generateSecret(KeySpec keySpec)
                         throws InvalidKeySpecException
Generate a Shacal2 key object from the provided key specification. The key specification has to be an instance of SecretKeySpec of type "Shacal2".
Overrides:
generateSecret in class SecretKeyFactory
Parameters:
keySpec - the key specification
Returns:
the secret key
Throws:
InvalidKeySpecException - if the key specification is of the wrong type.

getKeySpec

public KeySpec getKeySpec(SecretKey key,
                          java.lang.Class keySpec)
                   throws InvalidKeySpecException
Return a key specification of the given key object in the requested format. The format has to be equal to or a superclass of SecretKeySpec. The key has to be an instance of Shacal2Key.
Overrides:
getKeySpec in class SecretKeyFactory
Parameters:
key - the key
keySpec - 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 unrecognized format).

translateKey

public SecretKey translateKey(SecretKey key)
                       throws InvalidKeyException
Translates a Shacal2 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.