Package com.microej.crypto.test
Class AESGCMCipherTest
- java.lang.Object
-
- com.microej.crypto.test.AESGCMCipherTest
-
public class AESGCMCipherTest extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description AESGCMCipherTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidtestAES128GCM_16bytes()Test encryption of 16 data bytes using a 128-bit AES key, and verify the output against a precomputed ciphertext.voidtestAES128GCM_80bytes()Test encryption of 80 data bytes using a 128-bit AES key, and verify the output against a precomputed ciphertext.voidtestAES256GCM_16bytes()Test encryption of 16 data bytes using a 256-bit AES key, and verify the output against a precomputed ciphertext.voidtestAES256GCM_80bytes()Test encryption of 80 data bytes using a 256-bit AES key, and verify the output against a precomputed ciphertext.voidtestEncryptDecryptWithAAD()Test GCM mode specific encryption and authentication workflow.voidtestParallelCipherEncryption()Test parallel Cipher initialization and encryptionvoidtestRejectsKeyIvReuseOnReinit()Verifies that re-initializing a GCM cipher for encryption with the same key and IV is rejected, preventing catastrophic nonce reuse.voidtestUpdateAADWithNonZeroOffset()Verifies that additional authenticated data supplied at a non-zero offset is authenticated over the requested sub-range only.
-
-
-
Method Detail
-
testAES128GCM_16bytes
public void testAES128GCM_16bytes() throws java.lang.ExceptionTest 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.ExceptionTest 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.ExceptionTest 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.ExceptionTest 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.ExceptionTest parallel Cipher initialization and encryption- Throws:
java.lang.Exception
-
testEncryptDecryptWithAAD
public void testEncryptDecryptWithAAD() throws java.lang.ExceptionTest 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.ExceptionVerifies 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.ExceptionVerifies 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
-
-