- java.lang.Object
-
- java.security.KeyFactorySpi
-
- com.ibm.crypto.hdwrCCA.provider.ECKeyFactory
-
public final class ECKeyFactory extends java.security.KeyFactorySpi
This class implements the key factory service provider interface for the Elliptic Curve algorithm of the IBMJCECCA provider.
-
-
Constructor Summary
Constructors Constructor Description ECKeyFactory()
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.security.PrivateKey
engineGeneratePrivate(java.security.spec.KeySpec keySpec)
Generates an Elliptic Curve private key from the provided key specification (key material).protected java.security.PublicKey
engineGeneratePublic(java.security.spec.KeySpec keySpec)
Generates an Elliptic Curve public key from the provided key specification (key material).protected <T extends java.security.spec.KeySpec>
TengineGetKeySpec(java.security.Key key, java.lang.Class<T> keySpec)
Returns a specification (key material) of the given Elliptic Curve key object.protected java.security.Key
engineTranslateKey(java.security.Key key)
Translates an Elliptic Curve key object, whose provider may be unknown or potentially untrusted, into a corresponding Elliptic Curve key object of this key factory.
-
-
-
Method Detail
-
engineGeneratePublic
protected java.security.PublicKey engineGeneratePublic(java.security.spec.KeySpec keySpec) throws java.security.spec.InvalidKeySpecException
Generates an Elliptic Curve public key from the provided key specification (key material).- Specified by:
engineGeneratePublic
in classjava.security.KeyFactorySpi
- Parameters:
keySpec
- the specification (key material) of the public key. Three key specifications are supported, includingECPublicKeySpec
,KeyLabelKeySpec
, andX509EncodedKeySpec
. In the case of using aKeyLabelKeySpec
, the key label must point to an existing PKDS record- Returns:
- an Elliptic Curve public key representing the material contained within the specified key specification
- Throws:
java.security.spec.InvalidKeySpecException
- if the given key specification is inappropriate for this key factory
-
engineGeneratePrivate
protected java.security.PrivateKey engineGeneratePrivate(java.security.spec.KeySpec keySpec) throws java.security.spec.InvalidKeySpecException
Generates an Elliptic Curve private key from the provided key specification (key material).- Specified by:
engineGeneratePrivate
in classjava.security.KeyFactorySpi
- Parameters:
keySpec
- the specification (key material) of the private key. Four key specifications are supported, includingPKCS8EncodedKeySpec
,ECPrivateKeySpec
,KeyLabelKeySpec
, andECPrivateHWKeySpec
. In the case of using aKeyLabelKeySpec
, the key label must point to an existing PKDS record- Returns:
- an Elliptic Curve private key representing the material contained within the specified key specification
- Throws:
java.security.spec.InvalidKeySpecException
- if the given key specification is inappropriate for this key factory
-
engineGetKeySpec
protected <T extends java.security.spec.KeySpec> T engineGetKeySpec(java.security.Key key, java.lang.Class<T> keySpec) throws java.security.spec.InvalidKeySpecException
Returns a specification (key material) of the given Elliptic Curve key object.keySpec
identifies the specification class in which the key material should be returned.- Specified by:
engineGetKeySpec
in classjava.security.KeyFactorySpi
- Parameters:
key
- the Elliptic Curve public or private key. If public key, it must be an instance ofECPublicKey
. If private key, it must be an instance ofECPrivateHWKey
.keySpec
- the specification class in which the key material should be returned. For a public key, the supported specification classes areECPublicKeySpec
andX509EncodedKeySpec
. For a private key, the supported specification classes areECPrivateHWKeySpec
andKeyLabelKeySpec
, andECPrivateKeySpec
for CLEAR type keys.- Returns:
- the underlying key specification (key material) in an instance of the requested specification class
- Throws:
java.security.spec.InvalidKeySpecException
- if the requested key specification is inappropriate for the given key, or the given key cannot be dealt with
-
engineTranslateKey
protected java.security.Key engineTranslateKey(java.security.Key key) throws java.security.InvalidKeyException
Translates an Elliptic Curve key object, whose provider may be unknown or potentially untrusted, into a corresponding Elliptic Curve key object of this key factory.- Specified by:
engineTranslateKey
in classjava.security.KeyFactorySpi
- Parameters:
key
- the Elliptic Curve key whose provider is unknown or untrusted. It can be either an instance ofECPublicKey
or an instance ofECPrivateKey
.- Returns:
- the translated Elliptic Curve key
- Throws:
java.security.InvalidKeyException
- if the given key cannot be processed
-
-