com.ibm.crypto.provider
Class AESKeySpec

java.lang.Object
  extended by com.ibm.crypto.provider.AESKeySpec
All Implemented Interfaces:
KeySpec

public class AESKeySpec
extends Object
implements KeySpec

This class specifies a AES key.


Constructor Summary
AESKeySpec(byte[] key)
          Uses the bytes in key as the key material for the AES key.
AESKeySpec(byte[] key, int offset, int len)
          Uses the bytes in key, beginning at offset inclusive, as the key material for the AES key.
 
Method Summary
 byte[] getKey()
          Returns the AES key material.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AESKeySpec

public AESKeySpec(byte[] key)
           throws InvalidKeyException
Uses the bytes in key as the key material for the AES key.

The bytes that constitute the AES key are those between key[0] and key[key.length - 1] inclusive.

Parameters:
key - the buffer with the AES key material.
Throws:
InvalidKeyException - if the given key material is not 16, 24, or 32 bytes.

AESKeySpec

public AESKeySpec(byte[] key,
                  int offset,
                  int len)
           throws InvalidKeyException
Uses the bytes in key, beginning at offset inclusive, as the key material for the AES key.

The bytes that constitute the AES key are those between key[offset] and key[offset+len-1] inclusive.

Parameters:
key - the buffer with the AES key material.
offset - the offset in key, where the DES key material starts.
Throws:
InvalidKeyException - if the given key material, starting at offset inclusive, is not 16, 24, or 32 bytes.
Method Detail

getKey

public byte[] getKey()
Returns the AES key material.

Returns:
the AES key material.