Class AAD


  • public class AAD
    extends Object
    Additional authenticated data (AAD).

    See RFC 7518 (JWA), section 5.1, point 14.

    Version:
    2017-06-01
    Author:
    Vladimir Dzhuvinov
    • Constructor Detail

      • AAD

        public AAD()
    • Method Detail

      • compute

        public static byte[] compute​(JWEHeader jweHeader)
        Computes the Additional Authenticated Data (AAD) for the specified JWE header.
        Parameters:
        jweHeader - The JWE header. Must not be null.
        Returns:
        The AAD.
      • compute

        public static byte[] compute​(Base64URL encodedJWEHeader)
        Computes the Additional Authenticated Data (AAD) for the specified BASE64URL-encoded JWE header.
        Parameters:
        encodedJWEHeader - The BASE64URL-encoded JWE header. Must not be null.
        Returns:
        The AAD.
      • computeLength

        public static byte[] computeLength​(byte[] aad)
                                    throws IntegerOverflowException
        Computes the bit length of the specified Additional Authenticated Data (AAD). Used in AES/CBC/PKCS5Padding/HMAC-SHA2 encryption.
        Parameters:
        aad - The Additional Authenticated Data (AAD). Must not be null.
        Returns:
        The computed AAD bit length, as a 64 bit big-endian representation (8 byte array).
        Throws:
        IntegerOverflowException - On a integer overflow.