de.flexiprovider.core.dsa
Class DSAKeyFactory

java.lang.Object
  |
  +--java.security.KeyFactorySpi
        |
        +--de.flexiprovider.api.keys.KeyFactory
              |
              +--de.flexiprovider.core.dsa.interfaces.DSAKeyFactory
                    |
                    +--de.flexiprovider.core.dsa.DSAKeyFactory

public class DSAKeyFactory
extends DSAKeyFactory

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

Author:
Thomas Wahrenbruch, Michele Boivin

Field Summary
static java.lang.String OID
          The OID of DSA.
static java.lang.String OID2
          An alternative OID of DSA.
 
Constructor Summary
DSAKeyFactory()
           
 
Method Summary
 PrivateKey generatePrivate(KeySpec keySpec)
          Converts, if possible, a key specification into a DSAPrivKey.
 PublicKey generatePublic(KeySpec keySpec)
          Converts, if possible, a key specification into a DSAPubKey.
 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 CDC Standard Provider.
 
Methods inherited from class de.flexiprovider.core.dsa.interfaces.DSAKeyFactory
engineGeneratePrivate, engineGeneratePublic
 
Methods inherited from class de.flexiprovider.api.keys.KeyFactory
engineGetKeySpec, engineTranslateKey
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OID

public static final java.lang.String OID
The OID of DSA.

OID2

public static final java.lang.String OID2
An alternative OID of DSA.
Constructor Detail

DSAKeyFactory

public DSAKeyFactory()
Method Detail

generatePrivate

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

generatePublic

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

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 specifications are supported:

Overrides:
getKeySpec in class KeyFactory
Parameters:
key - the key
keySpec - the key specification
Returns:
the specification of the DSA key
Throws:
InvalidKeySpecException - if the key type or key specification is not supported.

translateKey

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