Class AESGCM


  • public class AESGCM
    extends java.lang.Object
    Author:
    matthias.unverzagt
    • Constructor Summary

      Constructors 
      Constructor Description
      AESGCM()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte[] decrypt​(byte[] encMessage, byte[] key)  
      static byte[] decrypt​(byte[] encMessage, byte[] key, byte[] associatedData)  
      static byte[] encrypt​(byte[] input, byte[] key)  
      static byte[] encrypt​(byte[] input, byte[] key, byte[] associatedData)  
      static byte[] encrypt​(byte[] input, byte[] key, byte[] associatedData, long counter)  
      static byte[] encrypt​(byte[] input, byte[] key, long counter)  
      static org.bouncycastle.crypto.io.CipherOutputStream encrypt​(java.io.OutputStream os, byte[] key)  
      static byte[] generateIV()  
      static byte[] generateIV​(long counter)  
      static javax.crypto.SecretKey generateSymmetricKey()  
      static javax.crypto.SecretKey keyFromBytes​(byte[] encodedKey)  
      static byte[] longToBytes​(long x)  
      • Methods inherited from class java.lang.Object

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

      • AESGCM

        public AESGCM()
    • Method Detail

      • encrypt

        public static byte[] encrypt​(byte[] input,
                                     byte[] key,
                                     long counter)
                              throws java.lang.Exception
        Throws:
        java.lang.Exception
      • encrypt

        public static byte[] encrypt​(byte[] input,
                                     byte[] key)
                              throws java.lang.Exception
        Throws:
        java.lang.Exception
      • encrypt

        public static byte[] encrypt​(byte[] input,
                                     byte[] key,
                                     byte[] associatedData)
                              throws java.lang.Exception
        Throws:
        java.lang.Exception
      • encrypt

        public static byte[] encrypt​(byte[] input,
                                     byte[] key,
                                     byte[] associatedData,
                                     long counter)
                              throws java.lang.Exception
        Throws:
        java.lang.Exception
      • decrypt

        public static byte[] decrypt​(byte[] encMessage,
                                     byte[] key)
                              throws java.lang.Exception
        Throws:
        java.lang.Exception
      • decrypt

        public static byte[] decrypt​(byte[] encMessage,
                                     byte[] key,
                                     byte[] associatedData)
                              throws java.lang.Exception
        Throws:
        java.lang.Exception
      • generateIV

        public static byte[] generateIV()
      • generateIV

        public static byte[] generateIV​(long counter)
      • longToBytes

        public static byte[] longToBytes​(long x)
      • keyFromBytes

        public static javax.crypto.SecretKey keyFromBytes​(byte[] encodedKey)
      • generateSymmetricKey

        public static javax.crypto.SecretKey generateSymmetricKey()
      • encrypt

        public static org.bouncycastle.crypto.io.CipherOutputStream encrypt​(java.io.OutputStream os,
                                                                            byte[] key)