de.flexiprovider.nf.iq.iqrdsa
Class IQRDSAKeyFactory

java.lang.Object
  |
  +--java.security.KeyFactorySpi
        |
        +--de.flexiprovider.api.keys.KeyFactory
              |
              +--de.flexiprovider.nf.iq.iqrdsa.IQRDSAKeyFactory

public class IQRDSAKeyFactory
extends KeyFactory

This class provides the translation between key specifications (IQRDSAPrivateKeySpec or IQRDSAPublicKeySpec), DER-encoded ASN.1 representations (X509EncodedKeySpec or PKCS8EncodedKeySpec), and keys (IQRDSAPrivateKey or IQRDSAPublicKey).

Author:
Birgit Henhapl, Michele Boivin, Ralf-P. Weinmann

Field Summary
static java.lang.String OID
          The OID of the IQRDSA key representation.
 
Constructor Summary
IQRDSAKeyFactory()
           
 
Method Summary
 PrivateKey generatePrivate(KeySpec keySpec)
          Generates a private key object from the provided key specification (key material).
 PublicKey generatePublic(KeySpec keySpec)
          Generates a public key object from the provided key specification (key material).
 KeySpec getKeySpec(Key key, java.lang.Class keySpec)
          Returns a specification (key material) of the given key object.
 Key translateKey(Key key)
          Translates a 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.KeyFactory
engineGeneratePrivate, engineGeneratePublic, 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 the IQRDSA key representation.
Constructor Detail

IQRDSAKeyFactory

public IQRDSAKeyFactory()
Method Detail

generatePrivate

public PrivateKey generatePrivate(KeySpec keySpec)
                           throws InvalidKeySpecException
Generates a private key object from the provided key specification (key material).
Overrides:
generatePrivate in class KeyFactory
Parameters:
keySpec - the specification (key material) of the private key
Returns:
the private key
Throws:
InvalidKeySpecException - if the given key specification is inappropriate for this key factory to produce a private key.

generatePublic

public PublicKey generatePublic(KeySpec keySpec)
                         throws InvalidKeySpecException
Generates a public key object from the provided key specification (key material).
Overrides:
generatePublic in class KeyFactory
Parameters:
keySpec - the specification (key material) of the public key
Returns:
the public key
Throws:
InvalidKeySpecException - if the given key specification is inappropriate for this key factory to produce a public key.

getKeySpec

public KeySpec getKeySpec(Key key,
                          java.lang.Class keySpec)
                   throws InvalidKeySpecException
Returns a specification (key material) of the given key object. keySpec identifies the specification class in which the key material should be returned. It could, for example, be IQRDSAPublicKeySpec.class, to indicate that the key material should be returned in an instance of the IQRDSAPublicKeySpec class.
Overrides:
getKeySpec in class KeyFactory
Parameters:
key - the key
keySpec - the specification class in which the key material should be returned
Returns:
the underlying key specification (key material) in an instance of the requested specification class
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 Key translateKey(Key key)
                 throws InvalidKeyException
Translates a key object, whose provider may be unknown or potentially untrusted, into a corresponding key object of this key factory. Currently, only the following key types are supported: IQRDSAPublicKey, IQRDSAPrivateKey.
Overrides:
translateKey in class KeyFactory
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.