de.flexiprovider.core.elgamal.semanticallysecure
Class SSVElGamalKeyFactory

java.lang.Object
  |
  +--java.security.KeyFactorySpi
        |
        +--de.flexiprovider.api.keys.KeyFactory
              |
              +--de.flexiprovider.core.elgamal.semanticallysecure.SSVElGamalKeyFactory

public class SSVElGamalKeyFactory
extends KeyFactory

This class is able to transform SSVElGamal-keys and SSVElGamal-key specs into a form that can be used with the FlexiCoreProvider.

Author:
Thomas Wahrenbruch, Roberto Samarone dos Santos Araújo
See Also:
SSVElGamal

Constructor Summary
SSVElGamalKeyFactory()
           
 
Method Summary
 PrivateKey generatePrivate(KeySpec keySpec)
          Converts, if possible, a key specification into a SSVElGamalPrivateKey.
 PublicKey generatePublic(KeySpec keySpec)
          Converts, if possible, a key specification into an SSVElGamalPublicKey.
 KeySpec getKeySpec(Key key, java.lang.Class keySpec)
          Converts a given key into a key specification, if possible.
 Key translateKey(Key key)
          Translates a key into a form known by the FlexiProvider.
 
Methods inherited from class de.flexiprovider.api.keys.KeyFactory
engineGeneratePrivate, engineGeneratePublic, engineGetKeySpec, engineTranslateKey
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SSVElGamalKeyFactory

public SSVElGamalKeyFactory()
Method Detail

generatePrivate

public PrivateKey generatePrivate(KeySpec keySpec)
                           throws InvalidKeySpecException
Converts, if possible, a key specification into a SSVElGamalPrivateKey. Currently the following key specifications are supported: SSVElGamalPrivateKeySpec, PKCS8EncodedKeySpec.
Overrides:
generatePrivate in class KeyFactory
Parameters:
keySpec - the key specification
Returns:
the private SSVElGamal key
Throws:
InvalidKeySpecException - if the KeySpec is not supported.
See Also:
SSVElGamalPrivateKey, SSVElGamalPrivateKeySpec

generatePublic

public PublicKey generatePublic(KeySpec keySpec)
                         throws InvalidKeySpecException
Converts, if possible, a key specification into an SSVElGamalPublicKey. Currently the following key specifications are supported: ElGamalPublicKeySpec, X509EncodedKeySpec.
Overrides:
generatePublic in class KeyFactory
Parameters:
keySpec - the key specification
Returns:
the public SSVElGamal key
Throws:
InvalidKeySpecException - if the KeySpec is not supported.
See Also:
SSVElGamalPublicKey, SSVElGamalPublicKeySpec

getKeySpec

public KeySpec getKeySpec(Key key,
                          java.lang.Class keySpec)
                   throws InvalidKeySpecException
Converts a given key into a key specification, if possible. Currently the following key specifications are supported:
Overrides:
getKeySpec in class KeyFactory
Parameters:
key - the key
keySpec - the class of which type the returned class should be
Returns:
the specification of the ElGamal key
Throws:
InvalidKeySpecException - if the specification is not supported.
See Also:
SSVElGamalPrivateKey, SSVElGamalPublicKey, SSVElGamalPrivateKeySpec, SSVElGamalPublicKeySpec

translateKey

public Key translateKey(Key key)
                 throws InvalidKeyException
Translates a key into a form known by the FlexiProvider. Currently the following "source" keys are supported: SSVElGamalPublicKey, SSVElGamalPrivateKey.
Overrides:
translateKey in class KeyFactory
Parameters:
key - the key
Returns:
a key of a known key-type
Throws:
InvalidKeyException - if the key is not supported.