Class AesUtil


  • public final class AesUtil
    extends java.lang.Object
    A collection of byte-manipulation functions, and some more specific functions for AES-CMAC / AES-SIV.

    Beware: some of the functions here are specific to the representation used for AES-CMAC and SIV, as described in their RFCs. These might not work if used in other contexts.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int BLOCK_SIZE  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte[] cmacPad​(byte[] x)
      Pad by adding a 1 bit, then pad with 0 bits to the next block limit.
      static byte[] dbl​(byte[] value)
      Multiplies value by x in the finite field GF(2^128) represented using the primitive polynomial x^128 + x^7 + x^2 + x + 1.
      • Methods inherited from class java.lang.Object

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

      • dbl

        public static byte[] dbl​(byte[] value)
        Multiplies value by x in the finite field GF(2^128) represented using the primitive polynomial x^128 + x^7 + x^2 + x + 1.
        Parameters:
        value - an arrays of 16 bytes representing an element of GF(2^128) using bigendian byte order.
      • cmacPad

        public static byte[] cmacPad​(byte[] x)
        Pad by adding a 1 bit, then pad with 0 bits to the next block limit. This is the standard for both CMAC and AES-SIV. - https://tools.ietf.org/html/rfc4493#section-2.4 - https://tools.ietf.org/html/rfc5297#section-2.1
        Parameters:
        x - The array to pad (will be copied)
        Returns:
        The padded array.