|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.security.KeyFactorySpi
|
+--iaik.security.dh.DHKeyFactory
This class converts Diffie Hellman keys (opaque representation) in their KeySpecs (transparent representation) and vice versa.
To convert, for instance, DER encoded PKCS#8 private key material (e.g. pkcs8_key_spec
instantiated from PKCS8EncodedKeySpec) into DHPrivateKey representation, use this KeyFactory
for DH keys:
KeyFactory dh_key_fac = KeyFactory.getInstance("DH");
DHPrivateKey dh_priv_key = (DHPrivateKey)dh_key_fac.generatePrivate(pkcs8_key_spec);
DHPrivateKeySpec,
DHPublicKeySpec,
DHPrivateKey,
DHPublicKey,
DHKeyAgreement| Constructor Summary | |
DHKeyFactory()
Default constructor for creating a DHKeyFactory. |
|
| Method Summary | |
protected PrivateKey |
engineGeneratePrivate(KeySpec keySpec)
Converts the given key specification to a PrivateKey. |
protected PublicKey |
engineGeneratePublic(KeySpec keySpec)
Converts the given key specification to a PublicKey. |
protected KeySpec |
engineGetKeySpec(Key key,
java.lang.Class classSpec)
Converts the given key into the requested key specification (key material). |
protected Key |
engineTranslateKey(Key key)
Translates the given key object of some unknown or untrusted provider into a key object supported by this DH key factory. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public DHKeyFactory()
KeyFactory.getInstance("DH"); for instantiating
a DHKeyFactory.
| Method Detail |
protected PrivateKey engineGeneratePrivate(KeySpec keySpec)
throws InvalidKeySpecException
keySpec - the key specification as DHPrivateKeySpec or PKCS8EncodedKeySpec
protected PublicKey engineGeneratePublic(KeySpec keySpec)
throws InvalidKeySpecException
keySpec - the key specification as DHPublicKeySpec or X509EncodedKeySpec
protected KeySpec engineGetKeySpec(Key key,
java.lang.Class classSpec)
throws InvalidKeySpecException
classSpec. Each attempt
to get key material of a type not matching to a given DH key will raise an exception.
key - the key to be converted, which either may be a DHPublicKey or a DHPrivateKey.keySpec - the key specification type into which the key shall be converted, which may be
a DHPublicKeySpec or a X509EncodedKeySpec if the given key is a DHPublicKey, or
a DHPrivateKeySpec or a PKCS8EncodedKeySpec if the given key is a DHPrivateKey
protected Key engineTranslateKey(Key key)
throws InvalidKeyException
DHPublicKey or DHPrivateKey.
key - the key of some unknown or untrusted provider
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||