Interface DESKey
DESKey contains an 8/16/24-byte key for single/2 key triple
DES/3 key triple DES operations.
When the key data is set, the key is initialized and ready for use.
- See Also:
-
Method Summary
Methods inherited from interface Key
clearKey, getSize, getType, isInitialized
-
Method Details
-
setKey
void setKey(byte[] keyData, short kOff) throws CryptoException, NullPointerException, ArrayIndexOutOfBoundsException Sets theKeydata. The plain text length of input key data is 8 bytes for DES, 16 bytes for 2-key triple DES and 24 bytes for 3-key triple DES. Input key data is copied into the internal representation.Note:
- If the key object implements the
javacardx.crypto.KeyEncryptioninterface and theCipherobject specified viasetKeyCipher()is notnull,keyDatais decrypted using theCipherobject.
- Parameters:
keyData- byte array containing key initialization datakOff- offset within keyData to start- Throws:
CryptoException- with the following reason code:CryptoException.ILLEGAL_VALUEif input data decryption is required and fails.
ArrayIndexOutOfBoundsException- ifkOffis negative or thekeyDataarray is too shortNullPointerException- if thekeyDataparameter isnull
- If the key object implements the
-
getKey
byte getKey(byte[] keyData, short kOff) Returns theKeydata in plain text. The length of output key data is 8 bytes for DES, 16 bytes for 2-key triple DES and 24 bytes for 3-key triple DES.- Parameters:
keyData- byte array to return key datakOff- offset withinkeyDatato start- Returns:
- the byte length of the key data returned
- Throws:
CryptoException- with the following reason code:CryptoException.UNINITIALIZED_KEYif the key data has not been successfully initialized since the time the initialized state of the key was set to false.
- See Also:
-