com.ibm.crypto.fips.provider
Class AESKeySpec
- java.lang.Object
-
- com.ibm.crypto.fips.provider.AESKeySpec
-
- All Implemented Interfaces:
- java.security.spec.KeySpec
public final class AESKeySpec extends java.lang.Object implements java.security.spec.KeySpecThis class specifies a AES key.
-
-
Constructor Summary
Constructors Constructor and Description AESKeySpec(byte[] key)Uses the bytes inkeyas the key material for the AES key.AESKeySpec(byte[] key, int offset, int len)Uses the bytes inkey, beginning atoffsetinclusive, as the key material for the AES key.
-
Method Summary
Methods Modifier and Type Method and Description byte[]getKey()Returns the AES key material.protected byte[]internalGetKey()
-
-
-
Constructor Detail
-
AESKeySpec
public AESKeySpec(byte[] key) throws java.security.InvalidKeyExceptionUses the bytes inkeyas the key material for the AES key.The bytes that constitute the AES key are those between
key[0]andkey[key.length - 1]inclusive.- Parameters:
key- the buffer with the AES key material.- Throws:
java.security.InvalidKeyException- if the given key material is not 16, 24, or 32 bytes.
-
AESKeySpec
public AESKeySpec(byte[] key, int offset, int len) throws java.security.InvalidKeyExceptionUses the bytes inkey, beginning atoffsetinclusive, as the key material for the AES key.The bytes that constitute the AES key are those between
key[offset]andkey[offset+len-1]inclusive.- Parameters:
key- the buffer with the AES key material.offset- the offset inkey, where the DES key material starts.- Throws:
java.security.InvalidKeyException- if the given key material, starting atoffsetinclusive, is not 16, 24, or 32 bytes.
-
-
Method Detail
-
getKey
public byte[] getKey()
Returns the AES key material.- Returns:
- the AES key material.
- Throws:
FIPSRuntimeException- if SelfTest.isFipsRunnable returns false.
-
internalGetKey
protected byte[] internalGetKey()
-
-