com.ibm.crypto.fips.provider
Class AESSecretKey
- java.lang.Object
-
- com.ibm.crypto.fips.provider.AESSecretKey
-
- All Implemented Interfaces:
- java.io.Serializable, java.security.Key, javax.crypto.SecretKey, javax.security.auth.Destroyable
public final class AESSecretKey extends java.lang.Object implements javax.crypto.SecretKeyThis class represents a AES key.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description AESSecretKey(byte[] key)Create a AES key from a given keyAESSecretKey(byte[] key, int offset)Uses the first 16, 20, or 24 bytes (T) inkey, beginning atoffset, as the AES key.
-
Method Summary
Methods Modifier and Type Method and Description protected voidfinalize()This function zeroizes the key so that it isn't in memory when GC is done.java.lang.StringgetAlgorithm()byte[]getEncoded()java.lang.StringgetFormat()voidzeroize()This function zeroizes the key so that it isn't in memory
-
-
-
Constructor Detail
-
AESSecretKey
public AESSecretKey(byte[] key) throws java.security.InvalidKeyExceptionCreate a AES key from a given key- Parameters:
key- the given key- Throws:
java.security.InvalidKeyException- if the given key has wrong size
-
AESSecretKey
public AESSecretKey(byte[] key, int offset) throws java.security.InvalidKeyExceptionUses the first 16, 20, or 24 bytes (T) inkey, beginning atoffset, as the AES key.- Parameters:
key- the buffer with the AES key bytes.offset- the offset inkey, where the AES key bytes start.- Throws:
java.security.InvalidKeyException- if invalid number of bytes is left for the key.
-
-
Method Detail
-
getEncoded
public byte[] getEncoded()
- Specified by:
getEncodedin interfacejava.security.Key
-
getAlgorithm
public java.lang.String getAlgorithm()
- Specified by:
getAlgorithmin interfacejava.security.Key
-
getFormat
public java.lang.String getFormat()
- Specified by:
getFormatin interfacejava.security.Key
-
zeroize
public void zeroize()
This function zeroizes the key so that it isn't in memory
-
finalize
protected void finalize()
This function zeroizes the key so that it isn't in memory when GC is done.- Overrides:
finalizein classjava.lang.Object
-
-