util: backport C++20 std::span and use it in various APIs
Implementation taken from span-lite by Martin Moene,
commit 337af6e23f6d3264136c16565546244da23159ba
Change-Id: Icfd0ba6841cbf6ef7870c31c881df940da9faf7e
diff --git a/tests/unit/security/pib/impl/identity-impl.t.cpp b/tests/unit/security/pib/impl/identity-impl.t.cpp
index 3890ddc..1b4527f 100644
--- a/tests/unit/security/pib/impl/identity-impl.t.cpp
+++ b/tests/unit/security/pib/impl/identity-impl.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -63,14 +63,15 @@
BOOST_REQUIRE_THROW(identity1.setDefaultKey(id1Key1Name), Pib::Error);
// add key
- identity1.addKey(id1Key1.data(), id1Key1.size(), id1Key1Name);
+ identity1.addKey(id1Key1, id1Key1Name);
BOOST_CHECK_NO_THROW(identity1.getKey(id1Key1Name));
// new key becomes default key when there is no default key
BOOST_REQUIRE_NO_THROW(identity1.getDefaultKey());
const Key& defaultKey0 = identity1.getDefaultKey();
BOOST_CHECK_EQUAL(defaultKey0.getName(), id1Key1Name);
- BOOST_CHECK(defaultKey0.getPublicKey() == id1Key1);
+ BOOST_CHECK_EQUAL_COLLECTIONS(defaultKey0.getPublicKey().begin(), defaultKey0.getPublicKey().end(),
+ id1Key1.begin(), id1Key1.end());
// remove key
identity1.removeKey(id1Key1Name);
@@ -78,17 +79,18 @@
BOOST_CHECK_THROW(identity1.getDefaultKey(), Pib::Error);
// set default key directly
- BOOST_REQUIRE_NO_THROW(identity1.setDefaultKey(id1Key1.data(), id1Key1.size(), id1Key1Name));
+ BOOST_REQUIRE_NO_THROW(identity1.setDefaultKey(id1Key1, id1Key1Name));
BOOST_REQUIRE_NO_THROW(identity1.getDefaultKey());
BOOST_CHECK_NO_THROW(identity1.getKey(id1Key1Name));
// check default key
const Key& defaultKey1 = identity1.getDefaultKey();
BOOST_CHECK_EQUAL(defaultKey1.getName(), id1Key1Name);
- BOOST_CHECK(defaultKey1.getPublicKey() == id1Key1);
+ BOOST_CHECK_EQUAL_COLLECTIONS(defaultKey1.getPublicKey().begin(), defaultKey1.getPublicKey().end(),
+ id1Key1.begin(), id1Key1.end());
// add another key
- identity1.addKey(id1Key2.data(), id1Key2.size(), id1Key2Name);
+ identity1.addKey(id1Key2, id1Key2Name);
BOOST_CHECK_EQUAL(identity1.getKeys().size(), 2);
// set default key through name
@@ -96,7 +98,8 @@
BOOST_REQUIRE_NO_THROW(identity1.getDefaultKey());
const Key& defaultKey2 = identity1.getDefaultKey();
BOOST_CHECK_EQUAL(defaultKey2.getName(), id1Key2Name);
- BOOST_CHECK(defaultKey2.getPublicKey() == id1Key2);
+ BOOST_CHECK_EQUAL_COLLECTIONS(defaultKey2.getPublicKey().begin(), defaultKey2.getPublicKey().end(),
+ id1Key2.begin(), id1Key2.end());
// remove key
identity1.removeKey(id1Key1Name);
@@ -104,10 +107,11 @@
BOOST_CHECK_EQUAL(identity1.getKeys().size(), 1);
// set default key directly again, change the default setting
- BOOST_REQUIRE_NO_THROW(identity1.setDefaultKey(id1Key1.data(), id1Key1.size(), id1Key1Name));
+ BOOST_REQUIRE_NO_THROW(identity1.setDefaultKey(id1Key1, id1Key1Name));
const Key& defaultKey3 = identity1.getDefaultKey();
BOOST_CHECK_EQUAL(defaultKey3.getName(), id1Key1Name);
- BOOST_CHECK(defaultKey3.getPublicKey() == id1Key1);
+ BOOST_CHECK_EQUAL_COLLECTIONS(defaultKey3.getPublicKey().begin(), defaultKey3.getPublicKey().end(),
+ id1Key1.begin(), id1Key1.end());
BOOST_CHECK_EQUAL(identity1.getKeys().size(), 2);
// remove all keys
@@ -125,11 +129,15 @@
auto pibImpl = make_shared<pib::PibMemory>();
IdentityImpl identity1(id1, pibImpl, true);
- identity1.addKey(id1Key1.data(), id1Key1.size(), id1Key1Name);
- BOOST_CHECK(identity1.getKey(id1Key1Name).getPublicKey() == id1Key1);
+ identity1.addKey(id1Key1, id1Key1Name);
+ auto k1 = identity1.getKey(id1Key1Name);
+ BOOST_CHECK_EQUAL_COLLECTIONS(k1.getPublicKey().begin(), k1.getPublicKey().end(),
+ id1Key1.begin(), id1Key1.end());
- identity1.addKey(id1Key2.data(), id1Key2.size(), id1Key1Name); // overwriting key should work
- BOOST_CHECK(identity1.getKey(id1Key1Name).getPublicKey() == id1Key2);
+ identity1.addKey(id1Key2, id1Key1Name); // overwriting key should work
+ auto k2 = identity1.getKey(id1Key1Name);
+ BOOST_CHECK_EQUAL_COLLECTIONS(k2.getPublicKey().begin(), k2.getPublicKey().end(),
+ id1Key2.begin(), id1Key2.end());
}
BOOST_AUTO_TEST_CASE(Errors)
@@ -139,11 +147,11 @@
BOOST_CHECK_THROW(IdentityImpl(id1, pibImpl, false), Pib::Error);
IdentityImpl identity1(id1, pibImpl, true);
- identity1.addKey(id1Key1.data(), id1Key1.size(), id1Key1Name);
- BOOST_CHECK_THROW(identity1.addKey(id2Key1.data(), id2Key1.size(), id2Key1Name), std::invalid_argument);
+ identity1.addKey(id1Key1, id1Key1Name);
+ BOOST_CHECK_THROW(identity1.addKey(id2Key1, id2Key1Name), std::invalid_argument);
BOOST_CHECK_THROW(identity1.removeKey(id2Key1Name), std::invalid_argument);
BOOST_CHECK_THROW(identity1.getKey(id2Key1Name), std::invalid_argument);
- BOOST_CHECK_THROW(identity1.setDefaultKey(id2Key1.data(), id2Key1.size(), id2Key1Name), std::invalid_argument);
+ BOOST_CHECK_THROW(identity1.setDefaultKey(id2Key1, id2Key1Name), std::invalid_argument);
BOOST_CHECK_THROW(identity1.setDefaultKey(id2Key1Name), std::invalid_argument);
}
diff --git a/tests/unit/security/pib/impl/key-impl.t.cpp b/tests/unit/security/pib/impl/key-impl.t.cpp
index be986a1..c59efb5 100644
--- a/tests/unit/security/pib/impl/key-impl.t.cpp
+++ b/tests/unit/security/pib/impl/key-impl.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -42,24 +42,26 @@
BOOST_AUTO_TEST_CASE(Basic)
{
auto pibImpl = make_shared<pib::PibMemory>();
- KeyImpl key11(id1Key1Name, id1Key1.data(), id1Key1.size(), pibImpl);
+ KeyImpl key11(id1Key1Name, id1Key1, pibImpl);
BOOST_CHECK_EQUAL(key11.getName(), id1Key1Name);
BOOST_CHECK_EQUAL(key11.getIdentity(), id1);
BOOST_CHECK_EQUAL(key11.getKeyType(), KeyType::EC);
- BOOST_CHECK(key11.getPublicKey() == id1Key1);
+ BOOST_CHECK_EQUAL_COLLECTIONS(key11.getPublicKey().begin(), key11.getPublicKey().end(),
+ id1Key1.begin(), id1Key1.end());
KeyImpl key11Bak(id1Key1Name, pibImpl);
BOOST_CHECK_EQUAL(key11Bak.getName(), id1Key1Name);
BOOST_CHECK_EQUAL(key11Bak.getIdentity(), id1);
BOOST_CHECK_EQUAL(key11Bak.getKeyType(), KeyType::EC);
- BOOST_CHECK(key11Bak.getPublicKey() == id1Key1);
+ BOOST_CHECK_EQUAL_COLLECTIONS(key11Bak.getPublicKey().begin(), key11Bak.getPublicKey().end(),
+ id1Key1.begin(), id1Key1.end());
}
BOOST_AUTO_TEST_CASE(CertificateOperation)
{
auto pibImpl = make_shared<pib::PibMemory>();
- KeyImpl key11(id1Key1Name, id1Key1.data(), id1Key1.size(), pibImpl);
+ KeyImpl key11(id1Key1Name, id1Key1, pibImpl);
BOOST_CHECK_NO_THROW(KeyImpl(id1Key1Name, pibImpl));
// key does not have any certificate
@@ -140,14 +142,16 @@
auto pibImpl = make_shared<pib::PibMemory>();
BOOST_CHECK_THROW(KeyImpl(id1Key1Name, pibImpl), Pib::Error);
- KeyImpl(id1Key1Name, id1Key1.data(), id1Key1.size(), pibImpl);
+ KeyImpl(id1Key1Name, id1Key1, pibImpl);
KeyImpl key1(id1Key1Name, pibImpl);
- KeyImpl(id1Key1Name, id1Key2.data(), id1Key2.size(), pibImpl); // overwriting of the key should work
+ KeyImpl(id1Key1Name, id1Key2, pibImpl); // overwriting of the key should work
KeyImpl key2(id1Key1Name, pibImpl);
- BOOST_CHECK(key1.getPublicKey() != key2.getPublicKey()); // key1 cached the original public key
- BOOST_CHECK(key2.getPublicKey() == id1Key2);
+ Buffer key1buf(key1.getPublicKey().begin(), key1.getPublicKey().end());
+ Buffer key2buf(key2.getPublicKey().begin(), key2.getPublicKey().end());
+ BOOST_CHECK(key1buf != key2buf); // key1 cached the original public key
+ BOOST_CHECK(key2buf == id1Key2);
key1.addCertificate(id1Key1Cert1);
BOOST_CHECK_EQUAL(key1.getCertificate(id1Key1Cert1.getName()), id1Key1Cert1);
@@ -172,12 +176,12 @@
auto pibImpl = make_shared<pib::PibMemory>();
BOOST_CHECK_THROW(KeyImpl(id1Key1Name, pibImpl), Pib::Error);
- KeyImpl key11(id1Key1Name, id1Key1.data(), id1Key1.size(), pibImpl);
+ KeyImpl key11(id1Key1Name, id1Key1, pibImpl);
BOOST_CHECK_THROW(KeyImpl(Name("/wrong"), pibImpl), std::invalid_argument);
- BOOST_CHECK_THROW(KeyImpl(Name("/wrong"), id1Key1.data(), id1Key1.size(), pibImpl), std::invalid_argument);
+ BOOST_CHECK_THROW(KeyImpl(Name("/wrong"), id1Key1, pibImpl), std::invalid_argument);
Buffer wrongKey;
- BOOST_CHECK_THROW(KeyImpl(id1Key2Name, wrongKey.data(), wrongKey.size(), pibImpl), std::invalid_argument);
+ BOOST_CHECK_THROW(KeyImpl(id1Key2Name, wrongKey, pibImpl), std::invalid_argument);
key11.addCertificate(id1Key1Cert1);
BOOST_CHECK_THROW(key11.addCertificate(id1Key2Cert1), std::invalid_argument);
diff --git a/tests/unit/security/pib/key-container.t.cpp b/tests/unit/security/pib/key-container.t.cpp
index 1a66573..25188a2 100644
--- a/tests/unit/security/pib/key-container.t.cpp
+++ b/tests/unit/security/pib/key-container.t.cpp
@@ -49,25 +49,28 @@
BOOST_CHECK_EQUAL(container.getLoadedKeys().size(), 0);
// add the first key
- Key key11 = container.add(id1Key1.data(), id1Key1.size(), id1Key1Name);
+ Key key11 = container.add(id1Key1, id1Key1Name);
BOOST_CHECK_EQUAL(key11.getName(), id1Key1Name);
- BOOST_CHECK(key11.getPublicKey() == id1Key1);
+ BOOST_CHECK_EQUAL_COLLECTIONS(key11.getPublicKey().begin(), key11.getPublicKey().end(),
+ id1Key1.begin(), id1Key1.end());
BOOST_CHECK_EQUAL(container.size(), 1);
BOOST_CHECK_EQUAL(container.getLoadedKeys().size(), 1);
BOOST_CHECK(container.find(id1Key1Name) != container.end());
// add the same key again
- Key key12 = container.add(id1Key1.data(), id1Key1.size(), id1Key1Name);
+ Key key12 = container.add(id1Key1, id1Key1Name);
BOOST_CHECK_EQUAL(key12.getName(), id1Key1Name);
- BOOST_CHECK(key12.getPublicKey() == id1Key1);
+ BOOST_CHECK_EQUAL_COLLECTIONS(key12.getPublicKey().begin(), key12.getPublicKey().end(),
+ id1Key1.begin(), id1Key1.end());
BOOST_CHECK_EQUAL(container.size(), 1);
BOOST_CHECK_EQUAL(container.getLoadedKeys().size(), 1);
BOOST_CHECK(container.find(id1Key1Name) != container.end());
// add the second key
- Key key21 = container.add(id1Key2.data(), id1Key2.size(), id1Key2Name);
+ Key key21 = container.add(id1Key2, id1Key2Name);
BOOST_CHECK_EQUAL(key21.getName(), id1Key2Name);
- BOOST_CHECK(key21.getPublicKey() == id1Key2);
+ BOOST_CHECK_EQUAL_COLLECTIONS(key21.getPublicKey().begin(), key21.getPublicKey().end(),
+ id1Key2.begin(), id1Key2.end());
BOOST_CHECK_EQUAL(container.size(), 2);
BOOST_CHECK_EQUAL(container.getLoadedKeys().size(), 2);
BOOST_CHECK(container.find(id1Key1Name) != container.end());
@@ -83,9 +86,11 @@
Key key1 = container.get(id1Key1Name);
Key key2 = container.get(id1Key2Name);
BOOST_CHECK_EQUAL(key1.getName(), id1Key1Name);
- BOOST_CHECK(key1.getPublicKey() == id1Key1);
+ BOOST_CHECK_EQUAL_COLLECTIONS(key1.getPublicKey().begin(), key1.getPublicKey().end(),
+ id1Key1.begin(), id1Key1.end());
BOOST_CHECK_EQUAL(key2.getName(), id1Key2Name);
- BOOST_CHECK(key2.getPublicKey() == id1Key2);
+ BOOST_CHECK_EQUAL_COLLECTIONS(key2.getPublicKey().begin(), key2.getPublicKey().end(),
+ id1Key2.begin(), id1Key2.end());
// create another container from the same PibImpl
// cache should be empty
@@ -122,7 +127,7 @@
KeyContainer container(id1, pibImpl);
- BOOST_CHECK_THROW(container.add(id2Key1.data(), id2Key1.size(), id2Key1Name), std::invalid_argument);
+ BOOST_CHECK_THROW(container.add(id2Key1, id2Key1Name), std::invalid_argument);
BOOST_CHECK_THROW(container.remove(id2Key1Name), std::invalid_argument);
BOOST_CHECK_THROW(container.get(id2Key1Name), std::invalid_argument);
}
@@ -132,8 +137,8 @@
auto pibImpl = make_shared<PibMemory>();
KeyContainer container(id1, pibImpl);
- container.add(id1Key1.data(), id1Key1.size(), id1Key1Name);
- container.add(id1Key2.data(), id1Key2.size(), id1Key2Name);
+ container.add(id1Key1, id1Key1Name);
+ container.add(id1Key2, id1Key2Name);
std::set<Name> keyNames;
keyNames.insert(id1Key1Name);
diff --git a/tests/unit/security/pib/key.t.cpp b/tests/unit/security/pib/key.t.cpp
index 544848f..8d0244f 100644
--- a/tests/unit/security/pib/key.t.cpp
+++ b/tests/unit/security/pib/key.t.cpp
@@ -44,8 +44,8 @@
BOOST_CHECK(!key);
BOOST_CHECK_EQUAL(static_cast<bool>(key), false);
- auto keyImpl = make_shared<detail::KeyImpl>(id1Key1Name, id1Key1.data(), id1Key1.size(),
- make_shared<pib::PibMemory>());
+ auto keyImpl = std::make_shared<detail::KeyImpl>(id1Key1Name, id1Key1,
+ std::make_shared<pib::PibMemory>());
key = Key(keyImpl);
BOOST_CHECK(key);
BOOST_CHECK_EQUAL(!key, false);
@@ -56,8 +56,8 @@
// of pib::Key in this test case.
BOOST_AUTO_TEST_CASE(SharedImpl)
{
- auto keyImpl = make_shared<detail::KeyImpl>(id1Key1Name, id1Key1.data(), id1Key1.size(),
- make_shared<pib::PibMemory>());
+ auto keyImpl = std::make_shared<detail::KeyImpl>(id1Key1Name, id1Key1,
+ std::make_shared<pib::PibMemory>());
Key key1(keyImpl);
Key key2(keyImpl);
BOOST_CHECK_EQUAL(key1, key2);
diff --git a/tests/unit/security/pib/pib-data-fixture.cpp b/tests/unit/security/pib/pib-data-fixture.cpp
index b641f31..d27c742 100644
--- a/tests/unit/security/pib/pib-data-fixture.cpp
+++ b/tests/unit/security/pib/pib-data-fixture.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -37,18 +37,13 @@
// class TestCertDataGenerator
// {
// public:
-// TestCertDataGenerator()
-// : tpm("test", "test", make_unique<tpm::BackEndMem>())
-// {
-// }
-
// void
// printTestDataForId(const std::string& prefix, const Name& id)
// {
-// for (int keyId : {1, 2}) {
+// for (auto keyId : {1u, 2u}) {
// Name keyName = tpm.createKey(id, EcKeyParams(name::Component::fromNumber(keyId)));
-// for (int certVersion : {1, 2}) {
+// for (auto certVersion : {1u, 2u}) {
// Name certName = keyName;
// certName
// .append("issuer")
@@ -79,22 +74,16 @@
// static void
// printBytes(const std::string& name, const Block& block)
// {
-// printBytes(name, block.wire(), block.size());
+// printBytes(name, make_span(block.wire(), block.size()));
// }
// static void
-// printBytes(const std::string& name, const Buffer& buffer)
-// {
-// printBytes(name, buffer.data(), buffer.size());
-// }
-
-// static void
-// printBytes(const std::string& name, const uint8_t* buf, size_t size)
+// printBytes(const std::string& name, span<const uint8_t> buf)
// {
// std::cout << "\nconst uint8_t " << name << "[] = {\n"
// << " ";
-// std::string hex = toHex(buf, size);
+// std::string hex = toHex(buf);
// for (size_t i = 0; i < hex.size(); i++) {
// if (i > 0 && i % 40 == 0)
@@ -103,7 +92,7 @@
// std::cout << "0x" << hex[i];
// std::cout << hex[++i];
-// if ((i + 1) != hex.size())
+// if (i + 1 != hex.size())
// std::cout << ", ";
// }
// std::cout << "\n"
@@ -112,7 +101,7 @@
// private:
// pib::PibMemory pib;
-// Tpm tpm;
+// Tpm tpm{"test", "test", make_unique<tpm::BackEndMem>()};
// };
// // The test data can be generated using this test case
diff --git a/tests/unit/security/pib/pib-impl.t.cpp b/tests/unit/security/pib/pib-impl.t.cpp
index 971d995..097b1c0 100644
--- a/tests/unit/security/pib/pib-impl.t.cpp
+++ b/tests/unit/security/pib/pib-impl.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -163,7 +163,7 @@
BOOST_CHECK_EQUAL(this->pib.hasIdentity(this->id1), false);
// add id1Key1, should be default, id1 should be added implicitly
- this->pib.addKey(this->id1, this->id1Key1Name, this->id1Key1.data(), this->id1Key1.size());
+ this->pib.addKey(this->id1, this->id1Key1Name, this->id1Key1);
BOOST_CHECK_EQUAL(this->pib.hasKey(this->id1Key1Name), true);
BOOST_CHECK_EQUAL(this->pib.hasIdentity(this->id1), true);
const Buffer& keyBits = this->pib.getKeyBits(this->id1Key1Name);
@@ -172,7 +172,7 @@
BOOST_CHECK_EQUAL(this->pib.getDefaultKeyOfIdentity(this->id1), this->id1Key1Name);
// add id1Key2, should not be default
- this->pib.addKey(this->id1, this->id1Key2Name, this->id1Key2.data(), this->id1Key2.size());
+ this->pib.addKey(this->id1, this->id1Key2Name, this->id1Key2);
BOOST_CHECK_EQUAL(this->pib.hasKey(this->id1Key2Name), true);
BOOST_CHECK_EQUAL(this->pib.getDefaultKeyOfIdentity(this->id1), this->id1Key1Name);
@@ -191,7 +191,7 @@
BOOST_CHECK_THROW(this->pib.getDefaultKeyOfIdentity(this->id1), Pib::Error);
// add id1Key2 back, should be default
- this->pib.addKey(this->id1, this->id1Key2Name, this->id1Key2.data(), this->id1Key2.size());
+ this->pib.addKey(this->id1, this->id1Key2Name, this->id1Key2);
BOOST_CHECK_NO_THROW(this->pib.getKeyBits(this->id1Key2Name));
BOOST_CHECK_EQUAL(this->pib.getDefaultKeyOfIdentity(this->id1), this->id1Key2Name);
@@ -274,11 +274,11 @@
this->pib.removeIdentity(this->id1);
BOOST_CHECK_THROW(this->pib.getDefaultIdentity(), Pib::Error);
- this->pib.addKey(this->id2, this->id2Key1Name, this->id2Key1.data(), this->id2Key1.size());
+ this->pib.addKey(this->id2, this->id2Key1Name, this->id2Key1);
BOOST_CHECK_EQUAL(this->pib.getDefaultIdentity(), this->id2);
BOOST_CHECK_EQUAL(this->pib.getDefaultKeyOfIdentity(this->id2), this->id2Key1Name);
- this->pib.addKey(this->id2, this->id2Key2Name, this->id2Key2.data(), this->id2Key2.size());
+ this->pib.addKey(this->id2, this->id2Key2Name, this->id2Key2);
BOOST_CHECK_EQUAL(this->pib.getDefaultKeyOfIdentity(this->id2), this->id2Key1Name);
this->pib.removeKey(this->id2Key1Name);
@@ -305,13 +305,13 @@
BOOST_CHECK_EQUAL(this->pib.hasKey(this->id1Key1Name), false);
// add id1Key1
- this->pib.addKey(this->id1, this->id1Key1Name, this->id1Key1.data(), this->id1Key1.size());
+ this->pib.addKey(this->id1, this->id1Key1Name, this->id1Key1);
BOOST_CHECK_EQUAL(this->pib.hasKey(this->id1Key1Name), true);
const Buffer& keyBits = this->pib.getKeyBits(this->id1Key1Name);
BOOST_CHECK(keyBits == this->id1Key1);
// check overwrite, add a key with the same name.
- this->pib.addKey(this->id1, this->id1Key1Name, this->id1Key2.data(), this->id1Key2.size());
+ this->pib.addKey(this->id1, this->id1Key1Name, this->id1Key2);
const Buffer& keyBits2 = this->pib.getKeyBits(this->id1Key1Name);
BOOST_CHECK(keyBits2 == this->id1Key2);
@@ -320,7 +320,7 @@
BOOST_CHECK_EQUAL(this->pib.hasCertificate(this->id1Key1Cert1.getName()), false);
// add id1Key1Cert1
- this->pib.addKey(this->id1, this->id1Key1Name, this->id1Key1.data(), this->id1Key1.size());
+ this->pib.addKey(this->id1, this->id1Key1Name, this->id1Key1);
this->pib.addCertificate(this->id1Key1Cert1);
BOOST_CHECK_EQUAL(this->pib.hasCertificate(this->id1Key1Cert1.getName()), true);