Interface DESKey

All Superinterfaces:
Key, SecretKey

public interface DESKey extends SecretKey
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

    Modifier and Type
    Method
    Description
    byte
    getKey(byte[] keyData, short kOff)
    Returns the Key data in plain text.
    void
    setKey(byte[] keyData, short kOff)
    Sets the Key data.

    Methods inherited from interface Key

    clearKey, getSize, getType, isInitialized
    Modifier and Type
    Method
    Description
    void
    Clears the key and sets its initialized state to false.
    short
    Returns the key size in number of bits.
    byte
    Returns the key interface type.
    boolean
    Reports the initialized state of the key.
  • Method Details

    • setKey

      void setKey(byte[] keyData, short kOff) throws CryptoException, NullPointerException, ArrayIndexOutOfBoundsException
      Sets the Key data. 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.KeyEncryption interface and the Cipher object specified via setKeyCipher() is not null, keyData is decrypted using the Cipher object.

      Parameters:
      keyData - byte array containing key initialization data
      kOff - offset within keyData to start
      Throws:
      CryptoException - with the following reason code:
      • CryptoException.ILLEGAL_VALUE if input data decryption is required and fails.
      ArrayIndexOutOfBoundsException - if kOff is negative or the keyData array is too short
      NullPointerException - if the keyData parameter is null
    • getKey

      byte getKey(byte[] keyData, short kOff)
      Returns the Key data 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 data
      kOff - offset within keyData to start
      Returns:
      the byte length of the key data returned
      Throws:
      CryptoException - with the following reason code:
      • CryptoException.UNINITIALIZED_KEY if the key data has not been successfully initialized since the time the initialized state of the key was set to false.
      See Also: