security: convert more functions to span

Update span-lite to commit 2962cb925c2323b936e4d5f366d2cddfb1b8dc68
and enable the initializer_list constructor.

Change-Id: Ie679315fe2dd69a8b9760c3b7dd47e97fcdc04c2
diff --git a/tests/unit/security/pib/identity.t.cpp b/tests/unit/security/pib/identity.t.cpp
index 4d79bbc..0198816 100644
--- a/tests/unit/security/pib/identity.t.cpp
+++ b/tests/unit/security/pib/identity.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2019 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -62,12 +62,12 @@
   BOOST_CHECK_NE(identity1, Identity());
   BOOST_CHECK_EQUAL(Identity(), Identity());
 
-  identity1.addKey(id1Key1.data(), id1Key1.size(), id1Key1Name);
+  identity1.addKey(id1Key1, id1Key1Name);
   BOOST_CHECK_NO_THROW(identity2.getKey(id1Key1Name));
   identity2.removeKey(id1Key1Name);
   BOOST_CHECK_THROW(identity1.getKey(id1Key1Name), pib::Pib::Error);
 
-  identity1.setDefaultKey(id1Key1.data(), id1Key1.size(), id1Key1Name);
+  identity1.setDefaultKey(id1Key1, id1Key1Name);
   BOOST_CHECK_NO_THROW(identity2.getDefaultKey());
 }
 
diff --git a/tests/unit/security/pib/pib.t.cpp b/tests/unit/security/pib/pib.t.cpp
index c40cddc..bcd90f9 100644
--- a/tests/unit/security/pib/pib.t.cpp
+++ b/tests/unit/security/pib/pib.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2019 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -46,7 +46,7 @@
   BOOST_CHECK(id);
   BOOST_CHECK_EQUAL(!id, false);
 
-  Key key = id.addKey(id1Key1.data(), id1Key1.size(), id1Key1Name);
+  Key key = id.addKey(id1Key1, id1Key1Name);
   BOOST_CHECK(key);
   BOOST_CHECK_EQUAL(!key, false);
 }
diff --git a/tests/unit/security/tpm/back-end.t.cpp b/tests/unit/security/tpm/back-end.t.cpp
index 0b22d54..9101aa3 100644
--- a/tests/unit/security/tpm/back-end.t.cpp
+++ b/tests/unit/security/tpm/back-end.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -133,7 +133,7 @@
   {
     using namespace transform;
     bufferSource(content1)
-      >> verifierFilter(DigestAlgorithm::SHA256, pubKey, sigValueSingle->data(), sigValueSingle->size())
+      >> verifierFilter(DigestAlgorithm::SHA256, pubKey, *sigValueSingle)
       >> boolSink(resultSingle);
   }
   BOOST_CHECK_EQUAL(resultSingle, true);
@@ -147,7 +147,7 @@
   {
     using namespace transform;
     bufferSource(InputBuffers{content1, content2})
-      >> verifierFilter(DigestAlgorithm::SHA256, pubKey, sigValueVector->data(), sigValueVector->size())
+      >> verifierFilter(DigestAlgorithm::SHA256, pubKey, *sigValueVector)
       >> boolSink(resultVector);
   }
   BOOST_CHECK_EQUAL(resultVector, true);
@@ -205,7 +205,7 @@
   {
     using namespace transform;
     bufferSource(content1)
-      >> verifierFilter(DigestAlgorithm::SHA256, pubKey, sigValueSingle->data(), sigValueSingle->size())
+      >> verifierFilter(DigestAlgorithm::SHA256, pubKey, *sigValueSingle)
       >> boolSink(resultSingle);
   }
   BOOST_CHECK_EQUAL(resultSingle, true);
@@ -219,7 +219,7 @@
   {
     using namespace transform;
     bufferSource(InputBuffers{content1, content2})
-      >> verifierFilter(DigestAlgorithm::SHA256, pubKey, sigValueVector->data(), sigValueVector->size())
+      >> verifierFilter(DigestAlgorithm::SHA256, pubKey, *sigValueVector)
       >> boolSink(resultVector);
   }
   BOOST_CHECK_EQUAL(resultVector, true);
diff --git a/tests/unit/security/transform/block-cipher.t.cpp b/tests/unit/security/transform/block-cipher.t.cpp
index 60944ad..d8b3c3b 100644
--- a/tests/unit/security/transform/block-cipher.t.cpp
+++ b/tests/unit/security/transform/block-cipher.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -67,9 +67,9 @@
 
   // encrypt
   OBufferStream os;
-  bufferSource(plainText) >>
-    blockCipher(BlockCipherAlgorithm::AES_CBC, CipherOperator::ENCRYPT,
-                key, sizeof(key), iv, sizeof(iv)) >> streamSink(os);
+  bufferSource(plainText)
+    >> blockCipher(BlockCipherAlgorithm::AES_CBC, CipherOperator::ENCRYPT, key, iv)
+    >> streamSink(os);
 
   auto buf = os.buf();
   BOOST_CHECK_EQUAL_COLLECTIONS(cipherText, cipherText + sizeof(cipherText),
@@ -77,9 +77,9 @@
 
   // decrypt
   OBufferStream os2;
-  bufferSource(cipherText) >>
-    blockCipher(BlockCipherAlgorithm::AES_CBC, CipherOperator::DECRYPT,
-                key, sizeof(key), iv, sizeof(iv)) >> streamSink(os2);
+  bufferSource(cipherText)
+    >> blockCipher(BlockCipherAlgorithm::AES_CBC, CipherOperator::DECRYPT, key, iv)
+    >> streamSink(os2);
 
   auto buf2 = os2.buf();
   BOOST_CHECK_EQUAL_COLLECTIONS(plainText, plainText + sizeof(plainText),
@@ -87,19 +87,19 @@
 
   // invalid key length
   const uint8_t badKey[] = {0x00, 0x01, 0x02, 0x03};
-  BOOST_CHECK_THROW(BlockCipher(BlockCipherAlgorithm::AES_CBC, CipherOperator::ENCRYPT,
-                                badKey, sizeof(badKey), iv, sizeof(iv)), Error);
+  BOOST_CHECK_THROW(BlockCipher(BlockCipherAlgorithm::AES_CBC, CipherOperator::ENCRYPT, badKey, iv),
+                    Error);
 
   // wrong iv length
   const uint8_t badIv[] = {0x00, 0x01, 0x02, 0x03};
-  BOOST_CHECK_THROW(BlockCipher(BlockCipherAlgorithm::AES_CBC, CipherOperator::ENCRYPT,
-                                key, sizeof(key), badIv, sizeof(badIv)), Error);
+  BOOST_CHECK_THROW(BlockCipher(BlockCipherAlgorithm::AES_CBC, CipherOperator::ENCRYPT, key, badIv),
+                    Error);
 }
 
 BOOST_AUTO_TEST_CASE(InvalidAlgorithm)
 {
-  BOOST_CHECK_THROW(BlockCipher(BlockCipherAlgorithm::NONE, CipherOperator::ENCRYPT,
-                                nullptr, 0, nullptr, 0), Error);
+  BOOST_CHECK_THROW(BlockCipher(BlockCipherAlgorithm::NONE, CipherOperator::DECRYPT, {}, {}), Error);
+  BOOST_CHECK_THROW(BlockCipher(BlockCipherAlgorithm::NONE, CipherOperator::ENCRYPT, {}, {}), Error);
 }
 
 BOOST_AUTO_TEST_SUITE_END() // TestBlockCipher
diff --git a/tests/unit/security/transform/buffer-source.t.cpp b/tests/unit/security/transform/buffer-source.t.cpp
index 4c56591..f957282 100644
--- a/tests/unit/security/transform/buffer-source.t.cpp
+++ b/tests/unit/security/transform/buffer-source.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -76,7 +76,7 @@
   std::string out3 = os3.str();
   BOOST_CHECK_EQUAL_COLLECTIONS(out3.begin(), out3.end(), in3.begin(), in3.end());
 
-  InputBuffers in4{make_span(in), {reinterpret_cast<const uint8_t*>(in2.data()), in2.size()}};
+  InputBuffers in4{{in}, {reinterpret_cast<const uint8_t*>(in2.data()), in2.size()}};
   std::ostringstream os4;
   bufferSource(in4) >> streamSink(os4);
   std::string out4 = os4.str();
diff --git a/tests/unit/security/transform/private-key.t.cpp b/tests/unit/security/transform/private-key.t.cpp
index 87d39fe..4be078b 100644
--- a/tests/unit/security/transform/private-key.t.cpp
+++ b/tests/unit/security/transform/private-key.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -681,7 +681,7 @@
     PublicKey pKey;
     pKey.loadPkcs8(*pKeyBits);
     BOOST_CHECK_NO_THROW(bufferSource(data) >>
-                         verifierFilter(DigestAlgorithm::SHA256, pKey, sig->data(), sig->size()) >>
+                         verifierFilter(DigestAlgorithm::SHA256, pKey, *sig) >>
                          boolSink(result));
   }
   else {
@@ -689,7 +689,7 @@
     BOOST_CHECK_THROW(sKey->derivePublicKey(), PrivateKey::Error);
 #endif
     BOOST_CHECK_NO_THROW(bufferSource(data) >>
-                         verifierFilter(DigestAlgorithm::SHA256, *sKey, sig->data(), sig->size()) >>
+                         verifierFilter(DigestAlgorithm::SHA256, *sKey, *sig) >>
                          boolSink(result));
   }
   BOOST_CHECK(result);
diff --git a/tests/unit/security/transform/public-key.t.cpp b/tests/unit/security/transform/public-key.t.cpp
index d572ecc..c888482 100644
--- a/tests/unit/security/transform/public-key.t.cpp
+++ b/tests/unit/security/transform/public-key.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -71,14 +71,14 @@
 {
   T dataSet;
 
-  auto pKeyPkcs8Base64 = reinterpret_cast<const uint8_t*>(dataSet.publicKeyPkcs8.data());
-  size_t pKeyPkcs8Base64Len = dataSet.publicKeyPkcs8.size();
+  auto pKeyPkcs8Base64 = make_span(reinterpret_cast<const uint8_t*>(dataSet.publicKeyPkcs8.data()),
+                                   dataSet.publicKeyPkcs8.size());
   OBufferStream os;
-  bufferSource(make_span(pKeyPkcs8Base64, pKeyPkcs8Base64Len)) >> base64Decode() >> streamSink(os);
+  bufferSource(pKeyPkcs8Base64) >> base64Decode() >> streamSink(os);
   auto pKeyPkcs8 = os.buf();
 
   PublicKey pKey1;
-  BOOST_CHECK_NO_THROW(pKey1.loadPkcs8Base64({pKeyPkcs8Base64, pKeyPkcs8Base64Len}));
+  BOOST_CHECK_NO_THROW(pKey1.loadPkcs8Base64(pKeyPkcs8Base64));
 
   std::stringstream ss2(dataSet.publicKeyPkcs8);
   PublicKey pKey2;
@@ -94,7 +94,7 @@
 
   OBufferStream os5;
   BOOST_REQUIRE_NO_THROW(pKey1.savePkcs8Base64(os5));
-  BOOST_CHECK_EQUAL_COLLECTIONS(pKeyPkcs8Base64, pKeyPkcs8Base64 + pKeyPkcs8Base64Len,
+  BOOST_CHECK_EQUAL_COLLECTIONS(pKeyPkcs8Base64.begin(), pKeyPkcs8Base64.end(),
                                 os5.buf()->begin(), os5.buf()->end());
 
   OBufferStream os6;
diff --git a/tests/unit/security/transform/signer-filter.t.cpp b/tests/unit/security/transform/signer-filter.t.cpp
index 063e3fc..cad6f04 100644
--- a/tests/unit/security/transform/signer-filter.t.cpp
+++ b/tests/unit/security/transform/signer-filter.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -92,7 +92,7 @@
   bufferSource(data) >> signerFilter(DigestAlgorithm::SHA256, sKey) >> streamSink(os2);
   auto sig = os2.buf();
 
-  BOOST_TEST(verifySignature({{data, sizeof(data)}}, sig->data(), sig->size(), pubKey->data(), pubKey->size()));
+  BOOST_TEST(verifySignature({data}, *sig, *pubKey));
 }
 
 BOOST_AUTO_TEST_CASE(Ecdsa)
@@ -130,7 +130,7 @@
   bufferSource(data) >> signerFilter(DigestAlgorithm::SHA256, sKey) >> streamSink(os2);
   auto sig = os2.buf();
 
-  BOOST_TEST(verifySignature({{data, sizeof(data)}}, sig->data(), sig->size(), pubKey->data(), pubKey->size()));
+  BOOST_TEST(verifySignature({data}, *sig, *pubKey));
 }
 
 BOOST_AUTO_TEST_SUITE(Hmac)
@@ -192,7 +192,7 @@
 BOOST_AUTO_TEST_CASE(Rfc4231Test2)
 {
   // Test case 2 (HMAC-SHA-256 only)
-  const char rawKey[] = "Jefe";
+  const uint8_t rawKey[] = {'J', 'e', 'f', 'e'};
   const std::string data("what do ya want for nothing?");
   const uint8_t hmacSha256[] = {0x5b, 0xdc, 0xc1, 0x46, 0xbf, 0x60, 0x75, 0x4e, 0x6a, 0x04,
                                 0x24, 0x26, 0x08, 0x95, 0x75, 0xc7, 0x5a, 0x00, 0x3f, 0x08,
@@ -200,7 +200,7 @@
                                 0x38, 0x43};
 
   PrivateKey key;
-  key.loadRaw(KeyType::HMAC, {reinterpret_cast<const uint8_t*>(rawKey), std::strlen(rawKey)});
+  key.loadRaw(KeyType::HMAC, rawKey);
 
   OBufferStream os256;
   bufferSource(data) >> signerFilter(DigestAlgorithm::SHA256, key) >> streamSink(os256);
diff --git a/tests/unit/security/transform/verifier-filter.t.cpp b/tests/unit/security/transform/verifier-filter.t.cpp
index 8feabfc..882890f 100644
--- a/tests/unit/security/transform/verifier-filter.t.cpp
+++ b/tests/unit/security/transform/verifier-filter.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -98,12 +98,12 @@
   bufferSource(DATA) >> signerFilter(DigestAlgorithm::SHA256, sKey) >> streamSink(os2);
   auto sig = os2.buf();
 
-  BOOST_CHECK_THROW(VerifierFilter(DigestAlgorithm::NONE, pKey, sig->data(), sig->size()), Error);
-  BOOST_CHECK_THROW(VerifierFilter(DigestAlgorithm::SHA256, sKey, sig->data(), sig->size()), Error);
+  BOOST_CHECK_THROW(VerifierFilter(DigestAlgorithm::NONE, pKey, *sig), Error);
+  BOOST_CHECK_THROW(VerifierFilter(DigestAlgorithm::SHA256, sKey, *sig), Error);
 
   bool result = false;
   bufferSource(DATA) >>
-    verifierFilter(DigestAlgorithm::SHA256, pKey, sig->data(), sig->size()) >>
+    verifierFilter(DigestAlgorithm::SHA256, pKey, *sig) >>
     boolSink(result);
 
   BOOST_CHECK_EQUAL(result, true);
@@ -144,12 +144,12 @@
   bufferSource(DATA) >> signerFilter(DigestAlgorithm::SHA256, sKey) >> streamSink(os2);
   auto sig = os2.buf();
 
-  BOOST_CHECK_THROW(VerifierFilter(DigestAlgorithm::NONE, pKey, sig->data(), sig->size()), Error);
-  BOOST_CHECK_THROW(VerifierFilter(DigestAlgorithm::SHA256, sKey, sig->data(), sig->size()), Error);
+  BOOST_CHECK_THROW(VerifierFilter(DigestAlgorithm::NONE, pKey, *sig), Error);
+  BOOST_CHECK_THROW(VerifierFilter(DigestAlgorithm::SHA256, sKey, *sig), Error);
 
   bool result = false;
   bufferSource(DATA) >>
-    verifierFilter(DigestAlgorithm::SHA256, pKey, sig->data(), sig->size()) >>
+    verifierFilter(DigestAlgorithm::SHA256, pKey, *sig) >>
     boolSink(result);
 
   BOOST_CHECK_EQUAL(result, true);
@@ -163,12 +163,12 @@
   bufferSource(DATA) >> signerFilter(DigestAlgorithm::SHA256, *sKey) >> streamSink(os);
   auto sig = os.buf();
 
-  BOOST_CHECK_THROW(VerifierFilter(DigestAlgorithm::NONE, *sKey, sig->data(), sig->size()), Error);
+  BOOST_CHECK_THROW(VerifierFilter(DigestAlgorithm::NONE, *sKey, *sig), Error);
 
 #if OPENSSL_VERSION_NUMBER < 0x30000000L // FIXME #5154
   bool result = false;
   bufferSource(DATA) >>
-    verifierFilter(DigestAlgorithm::SHA256, *sKey, sig->data(), sig->size()) >>
+    verifierFilter(DigestAlgorithm::SHA256, *sKey, *sig) >>
     boolSink(result);
 
   BOOST_CHECK_EQUAL(result, true);
@@ -178,9 +178,9 @@
 BOOST_AUTO_TEST_CASE(InvalidKey)
 {
   PublicKey pubKey;
-  BOOST_CHECK_THROW(VerifierFilter(DigestAlgorithm::SHA256, pubKey, nullptr, 0), Error);
+  BOOST_CHECK_THROW(VerifierFilter(DigestAlgorithm::SHA256, pubKey, {}), Error);
   PrivateKey privKey;
-  BOOST_CHECK_THROW(VerifierFilter(DigestAlgorithm::SHA256, privKey, nullptr, 0), Error);
+  BOOST_CHECK_THROW(VerifierFilter(DigestAlgorithm::SHA256, privKey, {}), Error);
 }
 
 BOOST_AUTO_TEST_SUITE_END() // TestVerifierFilter
diff --git a/tests/unit/security/verification-helpers.t.cpp b/tests/unit/security/verification-helpers.t.cpp
index 9925bb2..479a655 100644
--- a/tests/unit/security/verification-helpers.t.cpp
+++ b/tests/unit/security/verification-helpers.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -561,23 +561,23 @@
                                          dataset.badSigInterestOldFormat.size()));
 
   BOOST_CHECK(verifySignature(data, key));
-  BOOST_CHECK(verifySignature(data, keyRaw.data(), keyRaw.size()));
+  BOOST_CHECK(verifySignature(data, keyRaw));
   BOOST_CHECK(verifySignature(data, cert));
   BOOST_CHECK(verifySignature(interest, key));
-  BOOST_CHECK(verifySignature(interest, keyRaw.data(), keyRaw.size()));
+  BOOST_CHECK(verifySignature(interest, keyRaw));
   BOOST_CHECK(verifySignature(interest, cert));
   BOOST_CHECK(verifySignature(interestOldFormat, key));
-  BOOST_CHECK(verifySignature(interestOldFormat, keyRaw.data(), keyRaw.size()));
+  BOOST_CHECK(verifySignature(interestOldFormat, keyRaw));
   BOOST_CHECK(verifySignature(interestOldFormat, cert));
 
   BOOST_CHECK(!verifySignature(badSigData, key));
-  BOOST_CHECK(!verifySignature(badSigData, keyRaw.data(), keyRaw.size()));
+  BOOST_CHECK(!verifySignature(badSigData, keyRaw));
   BOOST_CHECK(!verifySignature(badSigData, cert));
   BOOST_CHECK(!verifySignature(badSigInterest, key));
-  BOOST_CHECK(!verifySignature(badSigInterest, keyRaw.data(), keyRaw.size()));
+  BOOST_CHECK(!verifySignature(badSigInterest, keyRaw));
   BOOST_CHECK(!verifySignature(badSigInterest, cert));
   BOOST_CHECK(!verifySignature(badSigInterestOldFormat, key));
-  BOOST_CHECK(!verifySignature(badSigInterestOldFormat, keyRaw.data(), keyRaw.size()));
+  BOOST_CHECK(!verifySignature(badSigInterestOldFormat, keyRaw));
   BOOST_CHECK(!verifySignature(badSigInterestOldFormat, cert));
 
   Data unsignedData("/some/data");
@@ -593,9 +593,9 @@
   BOOST_CHECK(!verifySignature(unsignedInterest2, cert));
   BOOST_CHECK(!verifySignature(unsignedInterest2, key));
 
-  uint8_t invalidKey[] = {0x00, 0x00};
-  BOOST_CHECK(!verifySignature(unsignedData, invalidKey, sizeof(invalidKey)));
-  BOOST_CHECK(!verifySignature(unsignedInterest1, invalidKey, sizeof(invalidKey)));
+  const uint8_t invalidKey[] = {0x00, 0x00};
+  BOOST_CHECK(!verifySignature(unsignedData, invalidKey));
+  BOOST_CHECK(!verifySignature(unsignedInterest1, invalidKey));
 
   // - base version of verifySignature is tested transitively
   // - pib::Key version is tested as part of key-chain.t.cpp (Security/TestKeyChain)
diff --git a/tests/unit/util/sha256.t.cpp b/tests/unit/util/sha256.t.cpp
index f6e0ec3..501a015 100644
--- a/tests/unit/util/sha256.t.cpp
+++ b/tests/unit/util/sha256.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2022 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -196,7 +196,7 @@
                             0x01, 0xCC, 0x4B, 0xF9, 0x06, 0x13, 0xE0, 0x81,
                             0x4F, 0x00, 0xA7, 0xB0, 0x8B, 0xC7, 0xC6, 0x48,
                             0xFD, 0x86, 0x5A, 0x2A, 0xF6, 0xA2, 0x2C, 0xC2};
-  std::string expected = toHex(origin, sizeof(origin));
+  const auto expected = toHex(origin);
 
   Sha256 digest;
   digest << "TEST";