Package com.microej.crypto.test
Class AESKeyWrapTest
- java.lang.Object
-
- com.microej.crypto.test.AESKeyWrapTest
-
public class AESKeyWrapTest extends java.lang.ObjectNote: No 192-bit key tests, 192-bit AES is commonly unsupported on constrained platforms
-
-
Constructor Summary
Constructors Constructor Description AESKeyWrapTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidtestAESWrap128_unwrap128()Test wrapping and unwrapping a 128-bit key using a 128-bit KEK.voidtestAESWrap128_wrap128()Test wrapping a 128-bit key using a 128-bit KEK, and verify the output against the RFC 3394 test vector (section 4.1).voidtestAESWrap256_unwrap256()Test wrapping and unwrapping a 256-bit key using a 256-bit KEK.voidtestAESWrap256_wrap128()Test wrapping a 128-bit key using a 256-bit KEK, and verify the output against the RFC 3394 test vector (section 4.3).voidtestAESWrap256_wrap256()Test wrapping a 256-bit key using a 256-bit KEK, and verify the output against the RFC 3394 test vector (section 4.6).voidtestParallelKeyWrap()Test parallel Cipher initialization and key wrapping.voidtestReinitWithDifferentKek()Initializing an already initialized key wrap cipher with another key-encryption key wraps as a freshly created cipher does, and the result unwraps.voidtestUnwrapRejectsAlteredBlob()Unwrapping a blob whose bytes were altered fails with theInvalidKeyExceptionthatCipher.unwrap(byte[], String, int)declares.
-
-
-
Method Detail
-
testAESWrap128_wrap128
public void testAESWrap128_wrap128() throws java.lang.ExceptionTest wrapping a 128-bit key using a 128-bit KEK, and verify the output against the RFC 3394 test vector (section 4.1).- Throws:
java.lang.Exception
-
testAESWrap256_wrap128
public void testAESWrap256_wrap128() throws java.lang.ExceptionTest wrapping a 128-bit key using a 256-bit KEK, and verify the output against the RFC 3394 test vector (section 4.3).- Throws:
java.lang.Exception
-
testAESWrap256_wrap256
public void testAESWrap256_wrap256() throws java.lang.ExceptionTest wrapping a 256-bit key using a 256-bit KEK, and verify the output against the RFC 3394 test vector (section 4.6).- Throws:
java.lang.Exception
-
testAESWrap128_unwrap128
public void testAESWrap128_unwrap128() throws java.lang.ExceptionTest wrapping and unwrapping a 128-bit key using a 128-bit KEK. Unwrap the result and verify it matches the original key.- Throws:
java.lang.Exception
-
testAESWrap256_unwrap256
public void testAESWrap256_unwrap256() throws java.lang.ExceptionTest wrapping and unwrapping a 256-bit key using a 256-bit KEK. Unwrap the result and verify it matches the original key.- Throws:
java.lang.Exception
-
testParallelKeyWrap
public void testParallelKeyWrap() throws java.lang.ThrowableTest parallel Cipher initialization and key wrapping.- Throws:
java.lang.Throwable
-
testUnwrapRejectsAlteredBlob
public void testUnwrapRejectsAlteredBlob() throws java.lang.ExceptionUnwrapping a blob whose bytes were altered fails with theInvalidKeyExceptionthatCipher.unwrap(byte[], String, int)declares. The library raises it only for the error code the abstraction layer declares for a failed integrity check, not for a backend failure.RFC 3394 wraps an integrity value alongside the key, and unwrapping is the only thing that checks it. A caller that cannot tell the check failing from the backend failing cannot tell a blob it should reject from a fault of its own, so the distinction is the contract and not an implementation detail.
- Throws:
java.lang.Exception
-
testReinitWithDifferentKek
public void testReinitWithDifferentKek() throws java.lang.ExceptionInitializing an already initialized key wrap cipher with another key-encryption key wraps as a freshly created cipher does, and the result unwraps.The key wrap cipher has a close path of its own in the backend, reached from the second initialization only. A wrap is one operation, so no data can be fed to the first context before the second initialization.
- Throws:
java.lang.Exception
-
-