com.ibm.crypto.hdwrCCA.provider
Class HMACKey
- java.lang.Object
-
- com.ibm.crypto.hdwrCCA.provider.HMACKey
-
- All Implemented Interfaces:
- java.io.Serializable, java.security.Key, javax.crypto.SecretKey, javax.security.auth.Destroyable
public class HMACKey extends java.lang.Object implements javax.crypto.SecretKeyThis class represents an HMAC secret key.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voiddeleteCKDSEntry()Delete the CKDS entry associated with this key object.booleanequals(java.lang.Object obj)Performs a deep compare to determine whether the given object represents a key identical to the key represented by this object.protected voidfinalize()Sets the bytes of this key, ICSF token, or CKDS label to zero when there are no more references to this key object.java.lang.StringgetAlgorithm()Returns the HMAC algorithm name associated with this key object.byte[]getEncoded()Returns the CKDS label for a"CKDSLabel"type key.java.lang.StringgetFormat()Returns the key type or key format of this key object, this will always be"CKDSLabel".java.lang.StringgetLabelString()Returns a copy of the CKDS label associated with this key object if this is a"CKDSLabel"key object.inthashCode()Calculates a hash code value for this key object.
-
-
-
Method Detail
-
getEncoded
public byte[] getEncoded()
Returns the CKDS label for a"CKDSLabel"type key.Note that 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:
getEncodedin interfacejava.security.Key- Returns:
- a clone of the encoded key value which will be the CKDS label of the key. The CKDS label returned will be in the IBM-1047 codepage. If an error is encountered, null is returned.
-
getLabelString
public java.lang.String getLabelString() throws java.security.InvalidKeyExceptionReturns a copy of the CKDS label associated with this key object if this is a"CKDSLabel"key object.- Returns:
- a copy of the CKDS label if this is a
"CKDSLabel"key object. This value will be exactly what is used within the CCA key repository as a label, including trailing blanks. - Throws:
java.security.InvalidKeyException- if this is not a"CKDSLabel"key object.
-
getAlgorithm
public java.lang.String getAlgorithm()
Returns the HMAC algorithm name associated with this key object.- Specified by:
getAlgorithmin interfacejava.security.Key- Returns:
- the HMAC algorithm name.
-
getFormat
public java.lang.String getFormat()
Returns the key type or key format of this key object, this will always be"CKDSLabel".- Specified by:
getFormatin interfacejava.security.Key- Returns:
- the key type of this key object. In this case
"CKDSLabel".
-
deleteCKDSEntry
public void deleteCKDSEntry() throws java.security.InvalidKeyExceptionDelete the CKDS entry associated with this key object.- Throws:
java.security.InvalidKeyException- if this is not a"CKDSLabel"key object.java.lang.RuntimeException- if there is an error while deleting the CKDS entry.
-
hashCode
public int hashCode()
Calculates a hash code value for this key object. Objects that are equal will also have the same hash value.- Overrides:
hashCodein classjava.lang.Object- Returns:
- the hash code value for this key object.
-
equals
public boolean equals(java.lang.Object obj)
Performs a deep compare to determine whether the given object represents a key identical to the key represented by this object.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- The object to compare to this key object- Returns:
- true if the given object is equal to this key object, false otherwise.
-
finalize
protected void finalize()
Sets the bytes of this key, ICSF token, or CKDS label to zero when there are no more references to this key object. This method is called by the garbage collector on an object when garbage collection determines that there are no more references to the object.- Overrides:
finalizein classjava.lang.Object
-
-