Class AESGCMCipherTest


  • public class AESGCMCipherTest
    extends java.lang.Object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void testAES128GCM_16bytes()
      Test encryption of 16 data bytes using a 128-bit AES key, and verify the output against a precomputed ciphertext.
      void testAES128GCM_80bytes()
      Test encryption of 80 data bytes using a 128-bit AES key, and verify the output against a precomputed ciphertext.
      void testAES256GCM_16bytes()
      Test encryption of 16 data bytes using a 256-bit AES key, and verify the output against a precomputed ciphertext.
      void testAES256GCM_80bytes()
      Test encryption of 80 data bytes using a 256-bit AES key, and verify the output against a precomputed ciphertext.
      void testEncryptDecryptWithAAD()
      Test GCM mode specific encryption and authentication workflow.
      void testParallelCipherEncryption()
      Test parallel Cipher initialization and encryption
      void testRejectsKeyIvReuseOnReinit()
      Verifies that re-initializing a GCM cipher for encryption with the same key and IV is rejected, preventing catastrophic nonce reuse.
      void testUpdateAADWithNonZeroOffset()
      Verifies that additional authenticated data supplied at a non-zero offset is authenticated over the requested sub-range only.
      • Methods inherited from class java.lang.Object

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

      • AESGCMCipherTest

        public AESGCMCipherTest()
    • Method Detail

      • testAES128GCM_16bytes

        public void testAES128GCM_16bytes()
                                   throws java.lang.Exception
        Test encryption of 16 data bytes using a 128-bit AES key, and verify the output against a precomputed ciphertext. Encryption in GCM mode, but without AAD provided.
        Throws:
        java.lang.Exception
      • testAES128GCM_80bytes

        public void testAES128GCM_80bytes()
                                   throws java.lang.Exception
        Test encryption of 80 data bytes using a 128-bit AES key, and verify the output against a precomputed ciphertext. Encryption in GCM mode, but without AAD provided.
        Throws:
        java.lang.Exception
      • testAES256GCM_16bytes

        public void testAES256GCM_16bytes()
                                   throws java.lang.Exception
        Test encryption of 16 data bytes using a 256-bit AES key, and verify the output against a precomputed ciphertext. Encryption in GCM mode, but without AAD provided.
        Throws:
        java.lang.Exception
      • testAES256GCM_80bytes

        public void testAES256GCM_80bytes()
                                   throws java.lang.Exception
        Test encryption of 80 data bytes using a 256-bit AES key, and verify the output against a precomputed ciphertext. Encryption in GCM mode, but without AAD provided.
        Throws:
        java.lang.Exception
      • testParallelCipherEncryption

        public void testParallelCipherEncryption()
                                          throws java.lang.Exception
        Test parallel Cipher initialization and encryption
        Throws:
        java.lang.Exception
      • testEncryptDecryptWithAAD

        public void testEncryptDecryptWithAAD()
                                       throws java.lang.Exception
        Test GCM mode specific encryption and authentication workflow. Test AEAD tag generation, AEAD failures after tampering on cipheredtext or AAD. NOTE: This test does not verify the multi-part update scenario (not supported yet).
        Throws:
        java.lang.Exception
      • testRejectsKeyIvReuseOnReinit

        public void testRejectsKeyIvReuseOnReinit()
                                           throws java.lang.Exception
        Verifies that re-initializing a GCM cipher for encryption with the same key and IV is rejected, preventing catastrophic nonce reuse. The guard must fire on the second initialization, before any encryption.
        Throws:
        java.lang.Exception
      • testUpdateAADWithNonZeroOffset

        public void testUpdateAADWithNonZeroOffset()
                                            throws java.lang.Exception
        Verifies that additional authenticated data supplied at a non-zero offset is authenticated over the requested sub-range only. Encrypting with the AAD embedded in a larger buffer must produce the same tag as decrypting with the AAD provided as a standalone array.
        Throws:
        java.lang.Exception