public class AESKeySpec extends java.lang.Object implements java.security.spec.KeySpec, AlgorithmStatus
Constructor and Description |
---|
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. |
Modifier and Type | Method and Description |
---|---|
byte[] |
getKey()
Returns the AES key material.
|
boolean |
isFipsApproved()
Module identifies if the cryptographic operation (algorithm) is FIPS certified
|
public AESKeySpec(byte[] key) throws java.security.InvalidKeyException
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.
key
- the buffer with the AES key material.java.security.InvalidKeyException
- if the given key material is not 16, 24, or 32 bytes.public AESKeySpec(byte[] key, int offset, int len) throws java.security.InvalidKeyException
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.
key
- the buffer with the AES key material.offset
- the offset in key
, where the DES key
material starts.java.security.InvalidKeyException
- if the given key material, starting at
offset
inclusive, is not 16, 24, or 32 bytes.public boolean isFipsApproved()
AlgorithmStatus
isFipsApproved
in interface AlgorithmStatus
AlgorithmStatus.isFipsApproved()
public byte[] getKey()
FIPSRuntimeException
- if SelfTest.isFipsRunnable returns false.© Portions Copyright 2003, 2012 IBM Corporation. All rights reserved.
© Portions Copyright 2003, 2012, Oracle and/or its affiliates. All rights reserved.