Class AAD


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

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

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

      Constructors 
      Constructor Description
      AAD()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte[] compute​(JWEHeader jweHeader)
      Computes the Additional Authenticated Data (AAD) for the specified JWE header.
      static byte[] compute​(Base64URL encodedJWEHeader)
      Computes the Additional Authenticated Data (AAD) for the specified BASE64URL-encoded JWE header.
      static byte[] computeLength​(byte[] aad)
      Computes the bit length of the specified Additional Authenticated Data (AAD).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.