Class CompositeKey


  • @Immutable
    public final class CompositeKey
    extends java.lang.Object
    Composite key used in AES/CBC/PKCS5Padding/HMAC-SHA2 encryption. This class is immutable.

    See RFC 7518 (JWA), section 5.2.

    See draft-mcgrew-aead-aes-cbc-hmac-sha2-01

    Version:
    2015-06-29
    Author:
    Vladimir Dzhuvinov
    • Constructor Summary

      Constructors 
      Constructor Description
      CompositeKey​(javax.crypto.SecretKey inputKey)
      Creates a new composite key from the specified secret key.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      javax.crypto.SecretKey getAESKey()
      Gets the extracted encryption key.
      javax.crypto.SecretKey getInputKey()
      Gets the input key.
      javax.crypto.SecretKey getMACKey()
      Gets the extracted MAC key.
      int getTruncatedMACByteLength()
      Gets the expected truncated MAC length.
      • Methods inherited from class java.lang.Object

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

      • CompositeKey

        public CompositeKey​(javax.crypto.SecretKey inputKey)
                     throws KeyLengthException
        Creates a new composite key from the specified secret key.
        Parameters:
        inputKey - The input key. Must be 256, 384 or 512 bits long. Must not be null.
        Throws:
        KeyLengthException - If the input key length is not supported.
    • Method Detail

      • getInputKey

        public javax.crypto.SecretKey getInputKey()
        Gets the input key.
        Returns:
        The input key.
      • getMACKey

        public javax.crypto.SecretKey getMACKey()
        Gets the extracted MAC key.
        Returns:
        The extracted MAC key.
      • getTruncatedMACByteLength

        public int getTruncatedMACByteLength()
        Gets the expected truncated MAC length.
        Returns:
        The expected truncated MAC length, in bytes.
      • getAESKey

        public javax.crypto.SecretKey getAESKey()
        Gets the extracted encryption key.
        Returns:
        The extracted encryption key.