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.SecretKey
    This 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 key
      AESSecretKey(byte[] key, int offset)
      Uses the first 16, 20, or 24 bytes (T) in key, beginning at offset, as the AES key.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      protected void finalize()
      This function zeroizes the key so that it isn't in memory when GC is done.
      java.lang.String getAlgorithm() 
      byte[] getEncoded() 
      java.lang.String getFormat() 
      void zeroize()
      This function zeroizes the key so that it isn't in memory
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface javax.security.auth.Destroyable

        destroy, isDestroyed
    • Constructor Detail

      • AESSecretKey

        public AESSecretKey(byte[] key)
                     throws java.security.InvalidKeyException
        Create 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.InvalidKeyException
        Uses the first 16, 20, or 24 bytes (T) in key, beginning at offset, as the AES key.
        Parameters:
        key - the buffer with the AES key bytes.
        offset - the offset in key, 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:
        getEncoded in interface java.security.Key
      • getAlgorithm

        public java.lang.String getAlgorithm()
        Specified by:
        getAlgorithm in interface java.security.Key
      • getFormat

        public java.lang.String getFormat()
        Specified by:
        getFormat in interface java.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:
        finalize in class java.lang.Object
© Portions Copyright 2003, 2014, 2015, 2016 IBM Corporation. All rights reserved.
© Portions Copyright 2003, 2014 Oracle and/or its affiliates. All rights reserved.