com.ibm.crypto.hdwrCCA.provider
Class DESKey
- java.lang.Object
-
- com.ibm.crypto.hdwrCCA.provider.DESKey
-
- All Implemented Interfaces:
- java.io.Serializable, java.security.Key, javax.crypto.SecretKey, javax.security.auth.Destroyable
public class DESKey extends java.lang.Object implements javax.crypto.SecretKey
This class represents a DES key.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description void
deleteCKDSEntry()
deleteCKDSEntry() If this key is a CKDS keylabel, then this method will delete the CKDS entry associated with it.boolean
equals(java.lang.Object obj)
Does a deep compare to determine whether the given object represents a key identical to the key represented by this object.protected void
finalize()
Ensures that the bytes of this key, token, or label are set to zero when there are no more references to it.java.lang.String
getAlgorithm()
Returns the encryption algorithm associated with this key object.byte[]
getEncoded()
Returns a clone of the encoded key value for a"RAW"
type key, or an ICSF token for an"ICSFToken"
type key, or a CKDS label for a"CKDSLabel"
type key.java.lang.String
getFormat()
Returns the key format of this key object.byte[]
getLabel()
Deprecated.This method is being replaced by the methodgetLabelString()
java.lang.String
getLabelString()
Returns a copy of the CKDS label associated with this key object if this is a"CKDSLabel"
key object.byte[]
getToken()
Returns a clone of the ICSF token associated with this key object if this is an"ICSFToken"
key object.int
hashCode()
Calculates a hash code value for the object.
-
-
-
Method Detail
-
getEncoded
public byte[] getEncoded()
Returns a clone of the encoded key value for a"RAW"
type key, or an ICSF token for an"ICSFToken"
type key, or a 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:
getEncoded
in interfacejava.security.Key
- Returns:
- A clone of the encoded key value if key type is
"RAW"
. If the key type is"ICSFToken"
or"CKDSLabel"
, then an ICSF token or a CKDS label will be returned, respectively. If a CKDS label is returned it will be returned in the IBM-1047 codepage. If an error is encountered, null is returned.
-
getToken
public byte[] getToken() throws java.security.InvalidKeyException
Returns a clone of the ICSF token associated with this key object if this is an"ICSFToken"
key object.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.
- Returns:
- A clone of the ICSF token if this is an
"ICSFToken"
key object. - Throws:
java.security.InvalidKeyException
- if this is not an"ICSFToken"
key object.
-
getLabel
public byte[] getLabel() throws java.security.InvalidKeyException
Deprecated. This method is being replaced by the methodgetLabelString()
Returns a clone of the CKDS label associated with this key object if this is a"CKDSLabel"
key object.- Returns:
- A clone of the CKDS label if this is a
"CKDSLabel"
key object. The label will be returned in the IBM-1047 codepage. - Throws:
java.security.InvalidKeyException
- if this is not a"CKDSLabel"
key object.
-
getLabelString
public java.lang.String getLabelString() throws java.security.InvalidKeyException
Returns 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 encryption algorithm associated with this key object.- Specified by:
getAlgorithm
in interfacejava.security.Key
- Returns:
- "DES"
-
getFormat
public java.lang.String getFormat()
Returns the key format of this key object.- Specified by:
getFormat
in interfacejava.security.Key
- Returns:
- the keyType for this object
-
deleteCKDSEntry
public void deleteCKDSEntry() throws java.security.InvalidKeyException
deleteCKDSEntry() If this key is a CKDS keylabel, then this method will delete the CKDS entry associated with it.- Throws:
java.security.InvalidKeyException
- is thrown if this is not a CKDSLabel key object.java.lang.RuntimeException
- is thrown if the CKDS entry delete returns a nonzero return code.
-
hashCode
public int hashCode()
Calculates a hash code value for the object. Objects that are equal will also have the same hashcode.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- the hash code for this object.
-
equals
public boolean equals(java.lang.Object obj)
Does a deep compare to determine whether the given object represents a key identical to the key represented by this object.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- The object to compare to this object- Returns:
- true if the given object equals this object, otherwise false.
-
finalize
protected void finalize()
Ensures that the bytes of this key, token, or label are set to zero when there are no more references to it.- Overrides:
finalize
in classjava.lang.Object
-
-