Class WrapperKey

java.lang.Object
com.ibm.crypto.hdwrCCA.provider.WrapperKey
All Implemented Interfaces:
Serializable, Key

public class WrapperKey extends Object implements 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 Details

    • WrapperKey

      public WrapperKey(PrivateKey key, KeyHWAttributes attrs) throws Exception
      Creates a WrapperKey from a given software key.
      Parameters:
      key - the key that is going to be migrated to hardware
      attrs - the hardware attributes that will be associated with the key once it is migrated to the hardware
      Throws:
      NullPointerException - if key 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 interface Key
      Returns:
      The encoded key value which may be a clone.
    • getAlgorithm

      public String getAlgorithm()
      Specified by:
      getAlgorithm in interface Key
    • getFormat

      public String getFormat()
      Specified by:
      getFormat in interface Key
    • getKey

      public Key getKey()
      Obtains the software key associated with this WrapperKey.
    • getKeyHWAttributes

      public KeyHWAttributes getKeyHWAttributes()
      Obtains the attributes that are desired to be used.