minor update
Change-Id: Idb04a60249eaefd36df683b43220512f16f7f4b1
diff --git a/tests/unit-tests/crypto-helpers.t.cpp b/tests/unit-tests/crypto-helpers.t.cpp
index 5834382..5f29a03 100644
--- a/tests/unit-tests/crypto-helpers.t.cpp
+++ b/tests/unit-tests/crypto-helpers.t.cpp
@@ -305,13 +305,23 @@
const uint8_t key[] = {0xbc, 0x22, 0xf3, 0xf0, 0x5c, 0xc4, 0x0d, 0xb9,
0x31, 0x1e, 0x41, 0x92, 0x96, 0x6f, 0xee, 0x92};
const std::string plaintext = "alongstringalongstringalongstringalongstringalongstringalongstringalongstringalongstring";
+ const std::string plaintext2 = "shortstring";
const std::string associatedData = "right";
const std::string wrongAssociatedData = "wrong";
uint32_t counter = 0;
+ // long string encryption
auto block = encodeBlockWithAesGcm128(ndn::tlv::Content, key, (uint8_t*)plaintext.c_str(), plaintext.size(),
(uint8_t*)associatedData.c_str(), associatedData.size(), counter);
auto decoded = decodeBlockWithAesGcm128(block, key, (uint8_t*)associatedData.c_str(), associatedData.size());
BOOST_CHECK_EQUAL(plaintext, std::string(decoded.get<char>(), decoded.size()));
+
+ // short string encryption
+ block = encodeBlockWithAesGcm128(ndn::tlv::Content, key, (uint8_t*)plaintext2.c_str(), plaintext2.size(),
+ (uint8_t*)associatedData.c_str(), associatedData.size(), counter);
+ decoded = decodeBlockWithAesGcm128(block, key, (uint8_t*)associatedData.c_str(), associatedData.size());
+ BOOST_CHECK_EQUAL(plaintext2, std::string(decoded.get<char>(), decoded.size()));
+
+ // use wrong associated data
BOOST_CHECK_THROW(decodeBlockWithAesGcm128(block, key,
(uint8_t*)wrongAssociatedData.c_str(),
wrongAssociatedData.size()), std::runtime_error);