Avoid deprecated ndn-cxx functions
Change-Id: Ib148262999a691760821a2ce1c05a5e6332e7e34
diff --git a/tests/key-chain-fixture.cpp b/tests/key-chain-fixture.cpp
index 29a75b8..b416524 100644
--- a/tests/key-chain-fixture.cpp
+++ b/tests/key-chain-fixture.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, Regents of the University of California
+ * Copyright (c) 2014-2022, Regents of the University of California
*
* NAC library is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
@@ -55,7 +55,7 @@
cert.setFreshnessPeriod(1_h);
// set content
- cert.setContent(key.getPublicKey().data(), key.getPublicKey().size());
+ cert.setContent(key.getPublicKey());
// set signature info
ndn::SignatureInfo info;
diff --git a/tests/unit/access-manager.t.cpp b/tests/unit/access-manager.t.cpp
index d15249f..dbbae40 100644
--- a/tests/unit/access-manager.t.cpp
+++ b/tests/unit/access-manager.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, Regents of the University of California
+ * Copyright (c) 2014-2022, Regents of the University of California
*
* NAC library is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
@@ -111,7 +111,7 @@
std::cerr << "const Block nacIdentity = \"";
auto block = m_keyChain.exportSafeBag(nacIdentity.getDefaultKey().getDefaultCertificate(),
"password", strlen("password"))->wireEncode();
- printHex(std::cerr, block.wire(), block.size(), true);
+ printHex(std::cerr, block, true);
std::cerr << "\"_block;\n\n";
std::cerr << "const std::vector<Block> userIdentities = {\n";
@@ -119,7 +119,7 @@
std::cerr << " \"";
block = m_keyChain.exportSafeBag(userId.getDefaultKey().getDefaultCertificate(),
"password", strlen("password"))->wireEncode();
- printHex(std::cerr, block.wire(), block.size(), true);
+ printHex(std::cerr, block, true);
std::cerr << "\"_block,\n";
}
std::cerr << "};\n\n";
@@ -127,7 +127,7 @@
std::cerr << "const std::vector<Block> managerPackets = {\n";
for (const auto& data : manager) {
std::cerr << " \"";
- printHex(std::cerr, data.wireEncode().wire(), data.wireEncode().size(), true);
+ printHex(std::cerr, data.wireEncode(), true);
std::cerr << "\"_block,\n";
}
std::cerr << "};\n\n";
diff --git a/tests/unit/encryptor.t.cpp b/tests/unit/encryptor.t.cpp
index 9439fcc..d9bafba 100644
--- a/tests/unit/encryptor.t.cpp
+++ b/tests/unit/encryptor.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, Regents of the University of California
+ * Copyright (c) 2014-2022, Regents of the University of California
*
* NAC library is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
@@ -103,8 +103,8 @@
encryptor.regenerateCk();
BOOST_CHECK_EQUAL(encryptor.m_isKekRetrievalInProgress, true);
- std::string plaintext = "Data to encrypt";
- auto block = encryptor.encrypt(reinterpret_cast<const uint8_t*>(plaintext.data()), plaintext.size());
+ const std::string plaintext = "Data to encrypt";
+ auto block = encryptor.encrypt({reinterpret_cast<const uint8_t*>(plaintext.data()), plaintext.size()});
EncryptedContent content(block);
auto ckPrefix = content.getKeyLocator();
@@ -147,8 +147,8 @@
size_t nErrors = 0;
onFailure.connect([&] (auto&&...) { ++nErrors; });
- std::string plaintext = "Data to encrypt";
- auto block = encryptor.encrypt(reinterpret_cast<const uint8_t*>(plaintext.data()), plaintext.size());
+ const std::string plaintext = "Data to encrypt";
+ auto block = encryptor.encrypt({reinterpret_cast<const uint8_t*>(plaintext.data()), plaintext.size()});
advanceClocks(1_ms, 10);
// check that KEK interests has been sent
@@ -204,8 +204,8 @@
std::cerr << "const std::vector<Block> encryptedBlobs = {\n";
for (size_t i = 0; i < 3; ++i) {
std::cerr << " \"";
- auto block = encryptor.encrypt(reinterpret_cast<const uint8_t*>(plaintext.data()), plaintext.size());
- printHex(std::cerr, block.wireEncode().wire(), block.wireEncode().size(), true);
+ auto block = encryptor.encrypt({reinterpret_cast<const uint8_t*>(plaintext.data()), plaintext.size()});
+ printHex(std::cerr, block.wireEncode(), true);
std::cerr << "\"_block,\n";
encryptor.regenerateCk();
@@ -216,7 +216,7 @@
std::cerr << "const std::vector<Block> encryptorPackets = {\n";
for (const auto& data : encryptor) {
std::cerr << " \"";
- printHex(std::cerr, data.wireEncode().wire(), data.wireEncode().size(), true);
+ printHex(std::cerr, data.wireEncode(), true);
std::cerr << "\"_block,\n";
}
std::cerr << "};\n\n";