Java Card
v2.2.2

javacard.security
Interface AESKey

All Superinterfaces:
Key, SecretKey

public interface AESKey
extends SecretKey

AESKey contains a 16/24/32 byte key for AES computations based on the Rijndael algorithm.

When the key data is set, the key is initialized and ready for use.

Since:
Java Card 2.2
See Also:
KeyBuilder, Signature, javacardx.crypto.Cipher, javacardx.crypto.KeyEncryption

Method Summary
 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 javacard.security.Key
clearKey, getSize, getType, isInitialized
 

Method Detail

setKey

void setKey(byte[] keyData,
            short kOff)
            throws CryptoException,
                   NullPointerException,
                   ArrayIndexOutOfBoundsException

Sets the Key data. The plaintext length of input key data is 16/24/32 bytes. The data format is big-endian and right-aligned (the least significant bit is the least significant bit of last byte). Input key data is copied into the internal representation.

Note:

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)
            throws CryptoException
Returns the Key data in plain text. The length of output key data is 16/24/32 bytes. The data format is big-endian and right-aligned (the least significant bit is the least significant bit of last byte).

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:
Key

Java Card
v2.2.2

Copyright © 1993-2005 Sun Microsystems, Inc. 4150 Network Circle,
Santa Clara, CA, 95054, U.S.A. All Rights Reserved.