add EncryptionTLV Encoding and Decoding

Change-Id: I67f6f733e0a02b894e49155167600963c3b2964e
diff --git a/tests/unit-tests/enc-tlv.t.cpp b/tests/unit-tests/enc-tlv.t.cpp
index 10e59d9..56817d3 100644
--- a/tests/unit-tests/enc-tlv.t.cpp
+++ b/tests/unit-tests/enc-tlv.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2017-2019, Regents of the University of California.
+ * Copyright (c) 2017-2020, Regents of the University of California.
  *
  * This file is part of ndncert, a certificate management system based on NDN.
  *
@@ -18,9 +18,9 @@
  * See AUTHORS.md for complete list of ndncert authors and contributors.
  */
 
-#include "crypto-support/enc-tlv.hpp"
-#include "crypto-support/crypto-helper.hpp"
 #include "boost-test.hpp"
+#include "crypto-support/crypto-helper.hpp"
+#include "crypto-support/enc-tlv.hpp"
 
 namespace ndn {
 namespace ndncert {
@@ -28,28 +28,20 @@
 
 BOOST_AUTO_TEST_SUITE(TestEncTlv)
 
-BOOST_AUTO_TEST_CASE(Test0)
+BOOST_AUTO_TEST_CASE(EncodingDecoding)
 {
-  ECDHState aliceState;
-  auto alicePub = aliceState.getRawSelfPubKey();
-  BOOST_CHECK(aliceState.context->publicKeyLen != 0);
-
-  ECDHState bobState;
-  auto bobPub = bobState.getRawSelfPubKey();
-  BOOST_CHECK(bobState.context->publicKeyLen != 0);
-
-  auto aliceResult = aliceState.deriveSecret(bobPub, bobState.context->publicKeyLen);
-  BOOST_CHECK(aliceState.context->sharedSecretLen != 0);
-
-  auto bobResult = bobState.deriveSecret(alicePub, aliceState.context->publicKeyLen);
-  BOOST_CHECK(bobState.context->sharedSecretLen != 0);
-
-  BOOST_CHECK_EQUAL_COLLECTIONS(aliceResult, aliceResult + 32,
-                                bobResult, bobResult + 32);
+  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 associatedData = "test";
+  auto block = encodeBlockWithAesGcm128(tlv::Content, key, (uint8_t*)plaintext.c_str(), plaintext.size(),
+                                        (uint8_t*)associatedData.c_str(), associatedData.size());
+  auto decoded = decodeBlockWithAesGcm128(block, key, (uint8_t*)associatedData.c_str(), associatedData.size());
+  BOOST_CHECK_EQUAL(plaintext, std::string((char*)decoded.get<uint8_t>(), decoded.size()));
 }
 
 BOOST_AUTO_TEST_SUITE_END()
 
-} // namespace tests
-} // namespace ndncert
-} // namespace ndn
+}  // namespace tests
+}  // namespace ndncert
+}  // namespace ndn