public class EcKeyFactory
extends java.security.KeyFactorySpi
An EC key factory is used to convert EC keys between opaque (java.security.Key)
and transparent (java.security.spec.KeySpec) representation.
This EC key factory is capable to converting to and from the following key
specifications:
java.security.spec.ECPublicKeySpecjava.security.spec.X509EncodedKeySpecjava.security.spec.ECPrivateKeySpecjava.security.spec.PKCS8EncodedKeySpecWhen converting to key representation, the key is always returned as one of the following:
When converting from key representation, the following key input formats are supported:
java.security.interfaces.ECPublicKey (this includes
EcPublicKey)java.security.PublicKey with algorithm 'EC' and format
'X.509' (this includes
ECDSAPublicKey)java.security.interfaces.ECPrivateKey (this includes
EcPrivateKey)java.security.PrivateKey with algorithm 'EC' and format
'PKCS#8' (this includes
ECDSAPrivateKey)EcKeyPairGenerator,
EcdsaSignature| Constructor and Description |
|---|
EcKeyFactory()
The constructor; creates a new instance of an EC key factory.
|
| Modifier and Type | Method and Description |
|---|---|
protected java.security.PrivateKey |
engineGeneratePrivate(java.security.spec.KeySpec keySpec)
Generates a private key object from the provided key specification (key
material).
|
protected java.security.PublicKey |
engineGeneratePublic(java.security.spec.KeySpec keySpec)
Generates a public key object from the provided key specification (key
material).
|
protected <T extends java.security.spec.KeySpec> |
engineGetKeySpec(java.security.Key key,
java.lang.Class<T> keySpec)
Returns a specification (key material) of the given key object
|
protected java.security.Key |
engineTranslateKey(java.security.Key key)
Translates a key object, whose provider may be unknown or potentially
untrusted, into a corresponding key object of this key factory.
|
public EcKeyFactory()
Applications should never use this constructor, instead the key factory
should be requested from the appropriate JCA/JCE cryptographic service
provider as follows: KeyFactory.getInstance("EC", "Entrust").
protected java.security.PublicKey engineGeneratePublic(java.security.spec.KeySpec keySpec)
throws java.security.spec.InvalidKeySpecException
engineGeneratePublic in class java.security.KeyFactorySpikeySpec - the specification (key material) of the public keyjava.security.spec.InvalidKeySpecException - if the given key specification is inappropriate for this
key factory to produce a public keyprotected java.security.PrivateKey engineGeneratePrivate(java.security.spec.KeySpec keySpec)
throws java.security.spec.InvalidKeySpecException
engineGeneratePrivate in class java.security.KeyFactorySpikeySpec - the specification (key material) of the private keyjava.security.spec.InvalidKeySpecException - if the given key specification is inappropriate for this
key factory to produce a private keyprotected <T extends java.security.spec.KeySpec> T engineGetKeySpec(java.security.Key key,
java.lang.Class<T> keySpec)
throws java.security.spec.InvalidKeySpecException
keySpec identifies the specification class in which the
key material should be returned. It could, for example, be
ECPublicKeySpec.class, to indicate that the key material
should be returned in an instance of the ECPublicKeySpec
class.
engineGetKeySpec in class java.security.KeyFactorySpikey - the keykeySpec - the specification class in which the key material should be
returnedjava.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 unrecognized format)protected java.security.Key engineTranslateKey(java.security.Key key)
throws java.security.InvalidKeyException
engineTranslateKey in class java.security.KeyFactorySpikey - the key whose provider is unknown or untrustedjava.security.InvalidKeyException - if the given key cannot be processed by this key factory