java.lang.Object
com.ibm.crypto.hdwrCCA.provider.WrapperKey
- All Implemented Interfaces:
Serializable
,Key
This class should be used to aid in the migration of a software key to
a hardware key. This class basically serves as a wrapper which contains
a software key and the desired hardware attributes that should be associated
with the key once it is imported into the hardware.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionWrapperKey
(PrivateKey key, KeyHWAttributes attrs) Creates a WrapperKey from a given software key. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
Returns the encoded key value.getKey()
Obtains the software key associated with this WrapperKey.Obtains the attributes that are desired to be used.
-
Constructor Details
-
WrapperKey
Creates a WrapperKey from a given software key.- Parameters:
key
- the key that is going to be migrated to hardwareattrs
- the hardware attributes that will be associated with the key once it is migrated to the hardware- Throws:
NullPointerException
- ifkey
is null.Exception
-- if the key passed is a RSAPrivateHWKey, DSAPrivateHWKey, or ECPrivateHWKey. WrapperKey is intended to be used with software keys. Keys of type RSAPrivateHWKey, DSAPrivateHWKey, or ECPrivateHWKey is not supported because they are already associated with the hardware.
- if the algorithm of the key being inserted is DSA and the key attributes are not of type DSAKeyHWAttributes.
- if the algorithm of the key being inserted is RSA and the key attributes are not of type RSAKeyHWAttributes.
- if the algorithm of the key being inserted is EC and the key attributes are not of type ECHWKeyAttributes.
-
-
Method Details
-
getEncoded
public byte[] getEncoded()Returns the encoded key value. The key value may be a clone depending on the behavior of the getEncoded() method of the underlying key.Note that if this method returns a clone of sensitive information. It is the caller's responsibility to zero out the information after it is no longer needed.
- Specified by:
getEncoded
in interfaceKey
- Returns:
- The encoded key value which may be a clone.
-
getAlgorithm
- Specified by:
getAlgorithm
in interfaceKey
-
getFormat
-
getKey
Obtains the software key associated with this WrapperKey. -
getKeyHWAttributes
Obtains the attributes that are desired to be used.
-