public final class ESDHKeyFactory
extends java.security.KeyFactorySpi
To convert, for instance, DER encoded PKCS#8 private key material (e.g. pkcs8_key_spec
instantiated from PKCS8EncodedKeySpec) into ESDHPrivateKey representation, use this KeyFactory
for ESDH keys:
KeyFactory dh_key_fac = KeyFactory.getInstance("ESDH");
ESDHPrivateKey dh_priv_key = (ESDHPrivateKey)dh_key_fac.generatePrivate(pkcs8_key_spec);
DHPrivateKeySpec,
DHPublicKeySpec,
ESDHPrivateKeySpec,
ESDHPublicKeySpec,
ESDHPrivateKey,
ESDHPublicKey,
ESDHKeyAgreement| Constructor and Description |
|---|
ESDHKeyFactory()
Default constructor for creating an ESDHKeyFactory.
|
| Modifier and Type | Method and Description |
|---|---|
protected java.security.PrivateKey |
engineGeneratePrivate(java.security.spec.KeySpec keySpec)
Converts the given key specification to a PrivateKey.
|
protected java.security.PublicKey |
engineGeneratePublic(java.security.spec.KeySpec keySpec)
Converts the given key specification to a PublicKey.
|
protected java.security.spec.KeySpec |
engineGetKeySpec(java.security.Key key,
java.lang.Class classSpec)
Converts the given key into the requested key specification (key material).
|
protected java.security.Key |
engineTranslateKey(java.security.Key key)
This method can't translate any keys.
|
public ESDHKeyFactory()
KeyFactory.getInstance("ESDH"); for instantiating
a ESDHKeyFactory.
protected java.security.PrivateKey engineGeneratePrivate(java.security.spec.KeySpec keySpec)
throws java.security.spec.InvalidKeySpecException
engineGeneratePrivate in class java.security.KeyFactorySpikeySpec - the key specification as ESDHPrivateKeySpec or PKCS8EncodedKeySpecjava.security.spec.InvalidKeySpecException - if the given key material is not
a ESDHPrivateKeySpec or PKCS8EncodedKeySpecprotected java.security.PublicKey engineGeneratePublic(java.security.spec.KeySpec keySpec)
throws java.security.spec.InvalidKeySpecException
engineGeneratePublic in class java.security.KeyFactorySpikeySpec - the key specification as ESDHPublicKeySpec or X509EncodedKeySpecjava.security.spec.InvalidKeySpecException - if the given key material is not
a ESDHPublicKeySpec or X509EncodedKeySpecprotected java.security.spec.KeySpec engineGetKeySpec(java.security.Key key,
java.lang.Class classSpec)
throws java.security.spec.InvalidKeySpecException
classSpec. Each attempt
to get key material of a type not matching to a given ESDH key will raise an exception.
engineGetKeySpec in class java.security.KeyFactorySpikey - the key to be converted, which either may be an ESDHPublicKey or an ESDHPrivateKey.classSpec - the key specification type into which the key shall be converted, which may be
an ESDHPublicKeySpec or a X509EncodedKeySpec if the given key is an ESDHPublicKey, or
an ESDHPrivateKeySpec or a PKCS8EncodedKeySpec if the given key is an ESDHPrivateKeyjava.security.spec.InvalidKeySpecException - if the given key cannot be converted into the
requested key specification object by this key factoryprotected java.security.Key engineTranslateKey(java.security.Key key)
throws java.security.InvalidKeyException
engineTranslateKey in class java.security.KeyFactorySpijava.security.InvalidKeyException