Class AEADUtils

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int getAuthTagLength​(int aeadAlgorithmTag)
      Return the length of the authentication tag used by the given AEAD algorithm in octets.
      static int getIVLength​(int aeadAlgorithmTag)
      Return the length of the IV used by the given AEAD algorithm in octets.
      static byte[][] splitMessageKeyAndIv​(byte[] messageKeyAndIv, int cipherAlgo, int aeadAlgo)
      Split a given byte array containing
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getIVLength

        public static int getIVLength​(int aeadAlgorithmTag)
        Return the length of the IV used by the given AEAD algorithm in octets.
        Parameters:
        aeadAlgorithmTag - AEAD algorithm identifier
        Returns:
        length of the IV
      • getAuthTagLength

        public static int getAuthTagLength​(int aeadAlgorithmTag)
        Return the length of the authentication tag used by the given AEAD algorithm in octets.
        Parameters:
        aeadAlgorithmTag - AEAD algorithm identifier
        Returns:
        length of the auth tag
      • splitMessageKeyAndIv

        public static byte[][] splitMessageKeyAndIv​(byte[] messageKeyAndIv,
                                                    int cipherAlgo,
                                                    int aeadAlgo)
        Split a given byte array containing
        m
        bytes of key and
        n-8
        bytes of IV into two separate byte arrays.
        m
        is the key length of the cipher algorithm, while
        n
        is the IV length of the AEAD algorithm. Note, that the IV is filled with
        n-8
        bytes only, the remainder is left as 0s. Return an array of both arrays with the key and index 0 and the IV at index 1.
        Parameters:
        messageKeyAndIv -
        m+n-8
        bytes of concatenated message key and IV
        cipherAlgo - symmetric cipher algorithm
        aeadAlgo - AEAD algorithm
        Returns:
        array of arrays containing message key and IV