Class AEADParameterSpec

  • All Implemented Interfaces:
    AlgorithmParameterSpec

    public class AEADParameterSpec
    extends IvParameterSpec
    ParameterSpec for AEAD modes which allows associated data to be added via an algorithm parameter spec.In normal circumstances you would only want to use this if you had to work with the pre-JDK1.7 Cipher class as associated data is ignored for the purposes of returning a Cipher's parameters.
    • Constructor Detail

      • AEADParameterSpec

        public AEADParameterSpec​(byte[] nonce,
                                 int macSizeInBits)
        Base constructor.
        Parameters:
        nonce - nonce/iv to be used
        macSizeInBits - macSize in bits
      • AEADParameterSpec

        public AEADParameterSpec​(byte[] nonce,
                                 int macSizeInBits,
                                 byte[] associatedData)
        Base constructor with prepended associated data.
        Parameters:
        nonce - nonce/iv to be used
        macSizeInBits - macSize in bits
        associatedData - associated data to be prepended to the cipher stream.
    • Method Detail

      • getMacSizeInBits

        public int getMacSizeInBits()
        Return the size of the MAC associated with this parameter spec.
        Returns:
        the MAC size in bits.
      • getAssociatedData

        public byte[] getAssociatedData()
        Return the associated data associated with this parameter spec.
        Returns:
        the associated data, null if there isn't any.
      • getNonce

        public byte[] getNonce()
        Return the nonce (same as IV) associated with this parameter spec.
        Returns:
        the nonce/IV.