Package com.microej.crypto.test
Class AESCipherTest
- java.lang.Object
-
- com.microej.crypto.test.AESCipherTest
-
public class AESCipherTest extends java.lang.ObjectTests for AES cipher operations including CBC, CTR, and authenticated cipher modes (e.g. GCM, CCM).Authenticated cipher tests are configuration-driven. All properties are prefixed with
com.microej.crypto.test.and hex-encoded unless stated otherwise.cipher.auth.transformations- comma-separated list of transformations to test (default:AES/GCM/NoPadding).<i>in the following properties refers to the 0-based index in this list.cipher.auth.<i>.keySizes- comma-separated key sizes in bits (default:128)cipher.auth.<i>.plaintext- plaintext (default:000102030405060708090a0b0c0d0e0f)cipher.auth.<i>.nonce- nonce (default:0123456789abcdef01234567, 12 bytes)cipher.auth.<i>.aad- additional authenticated data (default:0123456789abcdef0123456789abcdef)cipher.auth.<i>.key.<keySize>- raw key for the given key size (default:0123456789abcdef0123456789abcdef)cipher.auth.<i>.cipherTextAndTag.<keySize>- expected ciphertext+tag without AADcipher.auth.<i>.cipherTextAndTag.<keySize>.withAad- expected ciphertext+tag with AAD
-
-
Constructor Summary
Constructors Constructor Description AESCipherTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidtestAES128_16bytes()Test encryption of 16 data bytes using a 128-bit AES key, and verify the output against a precomputed ciphertext.voidtestAES128_16bytes_no_IV()Test encryption of 16 data bytes using a 128-bit AES key without an initialization vector.voidtestAES128_80bytes()Test encryption of 80 data bytes using a 128-bit AES key, and verify the output against a precomputed ciphertext.voidtestAES128_80bytes_no_IV()Test encryption of 80 data bytes using a 128-bit AES key without an initialization vector.voidtestAES256_16bytes()Test encryption of 16 data bytes using a 256-bit AES key, and verify the output against a precomputed ciphertext.voidtestAES256_16bytes_no_IV()Test encryption of 16 data bytes using a 256-bit AES key without an initialization vector.voidtestAES256_80bytes()Test encryption of 80 data bytes using a 256-bit AES key, and verify the output against a precomputed ciphertext.voidtestAES256_80bytes_no_IV()Test encryption of 80 data bytes using a 256-bit AES key without an initialization vector.voidtestAuthenticatedCipherDecrypt()voidtestAuthenticatedCipherDecryptWithAad()voidtestAuthenticatedCipherEncrypt()voidtestAuthenticatedCipherEncryptWithAad()voidtestMultiPartCipherAndResetOnDoFinalNoPadding()voidtestParallelCipherEncryption()Test parallel Cipher initialization and encryption
-
-
-
Method Detail
-
testAES128_16bytes
public void testAES128_16bytes() throws java.lang.ExceptionTest encryption of 16 data bytes using a 128-bit AES key, and verify the output against a precomputed ciphertext.- Throws:
java.lang.Exception
-
testAES128_80bytes
public void testAES128_80bytes() throws java.lang.ExceptionTest encryption of 80 data bytes using a 128-bit AES key, and verify the output against a precomputed ciphertext.- Throws:
java.lang.Exception
-
testAES256_16bytes
public void testAES256_16bytes() throws java.lang.ExceptionTest encryption of 16 data bytes using a 256-bit AES key, and verify the output against a precomputed ciphertext.- Throws:
java.lang.Exception
-
testAES256_80bytes
public void testAES256_80bytes() throws java.lang.ExceptionTest encryption of 80 data bytes using a 256-bit AES key, and verify the output against a precomputed ciphertext.- Throws:
java.lang.Exception
-
testAES128_16bytes_no_IV
public void testAES128_16bytes_no_IV() throws java.lang.ExceptionTest encryption of 16 data bytes using a 128-bit AES key without an initialization vector. Decrypt the result and verify it matches the original plaintext.- Throws:
java.lang.Exception
-
testAES128_80bytes_no_IV
public void testAES128_80bytes_no_IV() throws java.lang.ExceptionTest encryption of 80 data bytes using a 128-bit AES key without an initialization vector. Decrypt the result and verify it matches the original plaintext.- Throws:
java.lang.Exception
-
testAES256_16bytes_no_IV
public void testAES256_16bytes_no_IV() throws java.lang.ExceptionTest encryption of 16 data bytes using a 256-bit AES key without an initialization vector. Decrypt the result and verify it matches the original plaintext.- Throws:
java.lang.Exception
-
testAES256_80bytes_no_IV
public void testAES256_80bytes_no_IV() throws java.lang.ExceptionTest encryption of 80 data bytes using a 256-bit AES key without an initialization vector. Decrypt the result and verify it matches the original plaintext.- Throws:
java.lang.Exception
-
testParallelCipherEncryption
public void testParallelCipherEncryption() throws java.lang.ExceptionTest parallel Cipher initialization and encryption- Throws:
java.lang.Exception
-
testMultiPartCipherAndResetOnDoFinalNoPadding
public void testMultiPartCipherAndResetOnDoFinalNoPadding() throws java.security.GeneralSecurityException- Throws:
java.security.GeneralSecurityException
-
testAuthenticatedCipherEncrypt
public void testAuthenticatedCipherEncrypt() throws java.security.GeneralSecurityException- Throws:
java.security.GeneralSecurityException
-
testAuthenticatedCipherEncryptWithAad
public void testAuthenticatedCipherEncryptWithAad() throws java.security.GeneralSecurityException- Throws:
java.security.GeneralSecurityException
-
testAuthenticatedCipherDecrypt
public void testAuthenticatedCipherDecrypt() throws java.security.GeneralSecurityException- Throws:
java.security.GeneralSecurityException
-
testAuthenticatedCipherDecryptWithAad
public void testAuthenticatedCipherDecryptWithAad() throws java.security.GeneralSecurityException- Throws:
java.security.GeneralSecurityException
-
-