com.ibm.crypto.fips.provider

Class GCTR

  • java.lang.Object
    • com.ibm.crypto.fips.provider.GCTR
  • All Implemented Interfaces:
    AESConstants, GCMConstants


    public final class GCTR
    extends java.lang.Object
    implements AESConstants, GCMConstants
    Implementation of the GCTR function from NIST SP 800-38D. http://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pdf
    • Constructor Detail

      • GCTR

        public GCTR()
    • Method Detail

      • initKey

        public void initKey(java.security.Key k)
                     throws java.security.InvalidKeyException
        Initializes the key.
        Parameters:
        k - the key
        Throws:
        java.security.InvalidKeyException
      • setT

        public void setT(int t)
        Sets the length of the tag in bits.
        Parameters:
        t - the length of the tag in bits
      • gcm_ae

        public byte[] gcm_ae(byte[] IV,
                    byte[] P,
                    byte[] A,
                    byte[] C_out)
                      throws javax.crypto.IllegalBlockSizeException
        Performs an AES GCM encryption.
        Parameters:
        IV - initialization vector
        P - plain text
        A - additional authentication data
        C_out - cipher text
        Returns:
        the tag
        Throws:
        javax.crypto.IllegalBlockSizeException
      • gcm_ad

        public byte[] gcm_ad(byte[] IV,
                    byte[] C,
                    byte[] A,
                    byte[] T)
                      throws javax.crypto.IllegalBlockSizeException,
                             java.security.InvalidAlgorithmParameterException,
                             javax.crypto.BadPaddingException
        Performs an AES GCM decryption.
        Parameters:
        IV - initialization vector
        C - cipher text
        A - additional authentication data
        T - tag
        Returns:
        the plain text
        Throws:
        javax.crypto.IllegalBlockSizeException
        java.security.InvalidAlgorithmParameterException
        javax.crypto.BadPaddingException
      • gctr

        protected byte[] gctr(int[] icb,
                  byte[] X)
                       throws javax.crypto.IllegalBlockSizeException
        Throws:
        javax.crypto.IllegalBlockSizeException
© Portions Copyright 2003, 2014, 2015, 2016 IBM Corporation. All rights reserved.
© Portions Copyright 2003, 2014 Oracle and/or its affiliates. All rights reserved.