au.net.aba.crypto.provider
Class DHKeyFactory

java.lang.Object
  |
  +--java.security.KeyFactorySpi
        |
        +--au.net.aba.crypto.provider.DHKeyFactory

public class DHKeyFactory
extends java.security.KeyFactorySpi

This class is used to convert Diffie-Hellman keys into a format usable by the ABA provider. Currently this class can only convert from a KeySpec into a Key. The supported KeySpec classes are DHPublicKeySpec and DHPrivateKeySpec.

Not currently finished.

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

See Also:
java.security.KeyFactory

Field Summary
static java.lang.String ident
           
 
Constructor Summary
DHKeyFactory()
           
 
Method Summary
protected  java.security.PrivateKey engineGeneratePrivate(java.security.spec.KeySpec keySpec)
          Generates a Diffie-Hellman PrivateKey object from the provided key specification (key material).
protected  java.security.PublicKey engineGeneratePublic(java.security.spec.KeySpec keySpec)
          Generates a Diffie-Hellman PublicKey object from the provided key specification (key material).
protected  java.security.spec.KeySpec engineGetKeySpec(java.security.Key key, java.lang.Class spec)
          Returns a specification (key material) of the given key object in the requested format.
protected  java.security.Key engineTranslateKey(java.security.Key key)
          Translates a Diffie-Hellman 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
 

Field Detail

ident

public static final java.lang.String ident
Constructor Detail

DHKeyFactory

public DHKeyFactory()
Method Detail

engineGeneratePrivate

protected java.security.PrivateKey engineGeneratePrivate(java.security.spec.KeySpec keySpec)
                                                  throws java.security.spec.InvalidKeySpecException
Generates a Diffie-Hellman PrivateKey object from the provided key specification (key material). This class supports the DHPrivateKeySpec KeySpec class.
Throws:
java.security.spec.InvalidKeySpecException - The provided KeySpec was not a DHPrivateKeySpec KeySpec.
Overrides:
engineGeneratePrivate in class java.security.KeyFactorySpi

engineGeneratePublic

protected java.security.PublicKey engineGeneratePublic(java.security.spec.KeySpec keySpec)
                                                throws java.security.spec.InvalidKeySpecException
Generates a Diffie-Hellman PublicKey object from the provided key specification (key material). This class supports the DHPublicKeySpec KeySpec class.
Throws:
java.security.spec.InvalidKeySpecException - The provided KeySpec was not a DHPublicKeySpec KeySpec.
Overrides:
engineGeneratePublic in class java.security.KeyFactorySpi

engineGetKeySpec

protected java.security.spec.KeySpec engineGetKeySpec(java.security.Key key,
                                                      java.lang.Class spec)
                                               throws java.security.spec.InvalidKeySpecException
Returns a specification (key material) of the given key object in the requested format.

Currently supports standard DH keys, DHPublicKeySpec and DHPrivateKeySpec KeySpec classes.

Parameters:
key - the key
keySpec - the requested format in which the key material shall be returned
Throws:
java.security.spec.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).
Overrides:
engineGetKeySpec in class java.security.KeyFactorySpi

engineTranslateKey

protected java.security.Key engineTranslateKey(java.security.Key key)
                                        throws java.security.InvalidKeyException
Translates a Diffie-Hellman key object, whose provider may be unknown or potentially untrusted, into a corresponding key object of this key factory.
Parameters:
key - - the key whose provider is unknown or untrusted
Throws:
java.security.InvalidKeyException - if the given key cannot be processed by this key factory.
Overrides:
engineTranslateKey in class java.security.KeyFactorySpi