Migrate to ndn-cxx 0.7.1: Part 1
Change-Id: I621a6230272cfde5d84aa5ca9abdf40a91337491
diff --git a/src/ca-module.cpp b/src/ca-module.cpp
index 43becc5..40a4060 100644
--- a/src/ca-module.cpp
+++ b/src/ca-module.cpp
@@ -42,7 +42,7 @@
_LOG_INIT(ndncert.ca);
-CaModule::CaModule(Face& face, security::v2::KeyChain& keyChain,
+CaModule::CaModule(Face& face, security::KeyChain& keyChain,
const std::string& configPath, const std::string& storageType)
: m_face(face)
, m_keyChain(keyChain)
@@ -191,7 +191,7 @@
// get ECDH pub key and cert request
const auto& parameterTLV = request.getApplicationParameters();
std::string ecdhPub;
- shared_ptr<security::v2::Certificate> clientCert;
+ shared_ptr<security::Certificate> clientCert;
try {
NEW_RENEW_REVOKE::decodeApplicationParameters(parameterTLV, requestType, ecdhPub, clientCert);
} catch (const std::exception& e) {
@@ -236,7 +236,7 @@
// verify identity name
if (!m_config.m_caItem.m_caPrefix.isPrefixOf(clientCert->getIdentity())
- || !security::v2::Certificate::isValidName(clientCert->getName())
+ || !security::Certificate::isValidName(clientCert->getName())
|| clientCert->getIdentity().size() <= m_config.m_caItem.m_caPrefix.size()) {
_LOG_ERROR("An invalid certificate name is being requested " << clientCert->getName());
m_face.put(generateErrorDataPacket(request.getName(), ErrorCode::NAME_NOT_ALLOWED,
@@ -421,13 +421,13 @@
}
}
-security::v2::Certificate
+security::Certificate
CaModule::issueCertificate(const CaState& requestState)
{
auto expectedPeriod =
requestState.m_cert.getValidityPeriod().getPeriod();
security::ValidityPeriod period(expectedPeriod.first, expectedPeriod.second);
- security::v2::Certificate newCert;
+ security::Certificate newCert;
Name certName = requestState.m_cert.getKeyName();
certName.append("NDNCERT").append(std::to_string(random::generateSecureWord64()));
diff --git a/src/ca-module.hpp b/src/ca-module.hpp
index 04d594f..64af10a 100644
--- a/src/ca-module.hpp
+++ b/src/ca-module.hpp
@@ -31,7 +31,7 @@
class CaModule : noncopyable
{
public:
- CaModule(Face& face, security::v2::KeyChain& keyChain, const std::string& configPath,
+ CaModule(Face& face, security::KeyChain& keyChain, const std::string& configPath,
const std::string& storageType = "ca-storage-sqlite3");
~CaModule();
@@ -73,7 +73,7 @@
CaState
getCertificateRequest(const Interest& request);
- security::v2::Certificate
+ security::Certificate
issueCertificate(const CaState& requestState);
void
@@ -86,7 +86,7 @@
Face& m_face;
CaConfig m_config;
unique_ptr<CaStorage> m_storage;
- security::v2::KeyChain& m_keyChain;
+ security::KeyChain& m_keyChain;
uint8_t m_requestIdGenKey[32];
std::unique_ptr<Data> m_profileData;
diff --git a/src/ca-state.cpp b/src/ca-state.cpp
index e72b19f..b48f82d 100644
--- a/src/ca-state.cpp
+++ b/src/ca-state.cpp
@@ -43,7 +43,7 @@
}
CaState::CaState(const Name& caName, const std::string& requestId, RequestType requestType, Status status,
- const security::v2::Certificate& cert, Block encryptionKey)
+ const security::Certificate& cert, Block encryptionKey)
: m_caPrefix(caName)
, m_requestId(requestId)
, m_requestType(requestType)
@@ -54,7 +54,7 @@
}
CaState::CaState(const Name& caName, const std::string& requestId, RequestType requestType, Status status,
- const security::v2::Certificate& cert, const std::string& challengeType,
+ const security::Certificate& cert, const std::string& challengeType,
const std::string& challengeStatus, const system_clock::TimePoint& challengeTp,
size_t remainingTries, time::seconds remainingTime, JsonSection&& challengeSecrets,
Block encryptionKey)
diff --git a/src/ca-state.hpp b/src/ca-state.hpp
index 6806688..baf791c 100644
--- a/src/ca-state.hpp
+++ b/src/ca-state.hpp
@@ -49,9 +49,9 @@
public:
CaState();
CaState(const Name& caName, const std::string& requestId, RequestType requestType, Status status,
- const security::v2::Certificate& cert, Block m_encryptionKey);
+ const security::Certificate& cert, Block m_encryptionKey);
CaState(const Name& caName, const std::string& requestId, RequestType requestType, Status status,
- const security::v2::Certificate& cert, const std::string& challengeType,
+ const security::Certificate& cert, const std::string& challengeType,
const std::string& challengeStatus, const system_clock::TimePoint& challengeTp,
size_t remainingTries, time::seconds remainingTime, JsonSection&& challengeSecrets,
Block m_encryptionKey);
@@ -61,7 +61,7 @@
std::string m_requestId;
RequestType m_requestType;
Status m_status;
- security::v2::Certificate m_cert;
+ security::Certificate m_cert;
Block m_encryptionKey;
std::string m_challengeType;
diff --git a/src/ca-storage/ca-memory.cpp b/src/ca-storage/ca-memory.cpp
index 1fe27e1..e08a822 100644
--- a/src/ca-storage/ca-memory.cpp
+++ b/src/ca-storage/ca-memory.cpp
@@ -20,7 +20,7 @@
#include "ca-memory.hpp"
-#include <ndn-cxx/security/v2/validation-policy.hpp>
+#include <ndn-cxx/security/validation-policy.hpp>
namespace ndn {
namespace ndncert {
diff --git a/src/ca-storage/ca-sqlite.cpp b/src/ca-storage/ca-sqlite.cpp
index 8292f36..594df46 100644
--- a/src/ca-storage/ca-sqlite.cpp
+++ b/src/ca-storage/ca-sqlite.cpp
@@ -23,7 +23,7 @@
#include <sqlite3.h>
#include <boost/filesystem.hpp>
-#include <ndn-cxx/security/v2/validation-policy.hpp>
+#include <ndn-cxx/security/validation-policy.hpp>
#include <ndn-cxx/util/sqlite3-statement.hpp>
namespace ndn {
@@ -120,7 +120,7 @@
Name caName(statement.getBlock(1));
auto status = static_cast<Status>(statement.getInt(2));
auto challengeStatus = statement.getString(3);
- security::v2::Certificate cert(statement.getBlock(4));
+ security::Certificate cert(statement.getBlock(4));
auto challengeType = statement.getString(5);
auto challengeSecrets = statement.getString(6);
auto challengeTp = statement.getString(7);
@@ -217,7 +217,7 @@
Name caName(statement.getBlock(2));
auto status = static_cast<Status>(statement.getInt(3));
auto challengeStatus = statement.getString(4);
- security::v2::Certificate cert(statement.getBlock(5));
+ security::Certificate cert(statement.getBlock(5));
auto challengeType = statement.getString(6);
auto challengeSecrets = statement.getString(7);
auto challengeTp = statement.getString(8);
@@ -254,7 +254,7 @@
Name caName(statement.getBlock(2));
auto status = static_cast<Status>(statement.getInt(3));
auto challengeStatus = statement.getString(4);
- security::v2::Certificate cert(statement.getBlock(5));
+ security::Certificate cert(statement.getBlock(5));
auto challengeType = statement.getString(6);
auto challengeSecrets = statement.getString(7);
auto challengeTp = statement.getString(8);
diff --git a/src/configuration.cpp b/src/configuration.cpp
index 3cc4aa7..618202c 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -75,7 +75,7 @@
auto certificateStr = configJson.get(CONFIG_CERTIFICATE, "");
if (certificateStr != "") {
std::istringstream ss(certificateStr);
- m_cert = io::load<security::v2::Certificate>(ss);
+ m_cert = io::load<security::Certificate>(ss);
}
}
@@ -141,9 +141,9 @@
BOOST_THROW_EXCEPTION(std::runtime_error("Redirect-to item's ca-prefix or certificate cannot be empty."));
}
std::istringstream ss(caCertStr);
- auto caCert = io::load<security::v2::Certificate>(ss);
+ auto caCert = io::load<security::Certificate>(ss);
if (!m_redirection) {
- m_redirection = std::vector<std::shared_ptr<security::v2::Certificate>>();
+ m_redirection = std::vector<std::shared_ptr<security::Certificate>>();
}
m_redirection->push_back(caCert);
}
diff --git a/src/configuration.hpp b/src/configuration.hpp
index 40285e0..44c7df9 100644
--- a/src/configuration.hpp
+++ b/src/configuration.hpp
@@ -63,7 +63,7 @@
* CA's certificate. Only Client side will have m_cert.
* Default: nullptr.
*/
- std::shared_ptr<security::v2::Certificate> m_cert;
+ std::shared_ptr<security::Certificate> m_cert;
void
parse(const JsonSection& configJson);
@@ -126,7 +126,7 @@
* Used for CA redirection as specified in
* https://github.com/named-data/ndncert/wiki/NDNCERT-Protocol-0.3-PROBE-Extensions#probe-extension-for-redirection
*/
- boost::optional<std::vector<std::shared_ptr<security::v2::Certificate>>> m_redirection;
+ boost::optional<std::vector<std::shared_ptr<security::Certificate>>> m_redirection;
/**
* StatusUpdate Callback function
*/
diff --git a/src/identity-challenge/challenge-credential.cpp b/src/identity-challenge/challenge-credential.cpp
index f6e26c2..0d171e4 100644
--- a/src/identity-challenge/challenge-credential.cpp
+++ b/src/identity-challenge/challenge-credential.cpp
@@ -65,7 +65,7 @@
auto it = anchorList.begin();
for (; it != anchorList.end(); it++) {
std::istringstream ss(it->second.get("certificate", ""));
- auto cert = io::load<security::v2::Certificate>(ss);
+ auto cert = io::load<security::Certificate>(ss);
if (cert == nullptr) {
_LOG_ERROR("Cannot load the certificate from config file");
continue;
@@ -82,7 +82,7 @@
if (m_trustAnchors.empty()) {
parseConfigFile();
}
- security::v2::Certificate credential;
+ security::Certificate credential;
const uint8_t* signature;
size_t signatureLen;
const auto& elements = params.elements();
@@ -105,7 +105,7 @@
}
// verify the credential and the self-signed cert
- Name signingKeyName = credential.getSignature().getKeyLocator().getName();
+ Name signingKeyName = credential.getSignatureInfo().getKeyLocator().getName();
security::transform::PublicKey key;
const auto& pubKeyBuffer = credential.getPublicKey();
key.loadPkcs8(pubKeyBuffer.data(), pubKeyBuffer.size());
@@ -176,8 +176,8 @@
KeyChain& keyChain, const Name& issuedCertName, const std::string& requestId)
{
auto& pib = keyChain.getPib();
- auto id = pib.getIdentity(security::v2::extractIdentityFromCertName(issuedCertName));
- auto issuedCert = id.getKey(security::v2::extractKeyNameFromCertName(issuedCertName)).getCertificate(issuedCertName);
+ auto id = pib.getIdentity(security::extractIdentityFromCertName(issuedCertName));
+ auto issuedCert = id.getKey(security::extractKeyNameFromCertName(issuedCertName)).getCertificate(issuedCertName);
auto issuedCertTlv = issuedCert.wireEncode();
auto signatureTlv = keyChain.sign((uint8_t*)requestId.c_str(), requestId.length(), security::signingByCertificate(issuedCertName));
for (auto& item : params) {
diff --git a/src/identity-challenge/challenge-credential.hpp b/src/identity-challenge/challenge-credential.hpp
index 2c0229b..49670f6 100644
--- a/src/identity-challenge/challenge-credential.hpp
+++ b/src/identity-challenge/challenge-credential.hpp
@@ -76,7 +76,7 @@
parseConfigFile();
PUBLIC_WITH_TESTS_ELSE_PRIVATE:
- std::list<security::v2::Certificate> m_trustAnchors;
+ std::list<security::Certificate> m_trustAnchors;
std::string m_configFile;
};
diff --git a/src/ndncert-common.hpp b/src/ndncert-common.hpp
index c77cedb..a1077cc 100644
--- a/src/ndncert-common.hpp
+++ b/src/ndncert-common.hpp
@@ -47,7 +47,7 @@
#include <ndn-cxx/lp/nack.hpp>
#include <ndn-cxx/name.hpp>
#include <ndn-cxx/security/key-chain.hpp>
-#include <ndn-cxx/security/v2/certificate.hpp>
+#include <ndn-cxx/security/certificate.hpp>
#include <ndn-cxx/util/logger.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/assert.hpp>
diff --git a/src/protocol-detail/info.cpp b/src/protocol-detail/info.cpp
index 7c0e449..58e8fc3 100644
--- a/src/protocol-detail/info.cpp
+++ b/src/protocol-detail/info.cpp
@@ -24,13 +24,13 @@
namespace ndncert {
Block
-INFO::encodeDataContent(const CaProfile& caConfig, const security::v2::Certificate& certificate)
+INFO::encodeDataContent(const CaProfile& caConfig, const security::Certificate& certificate)
{
auto content = makeEmptyBlock(tlv::Content);
content.push_back(makeNestedBlock(tlv_ca_prefix, caConfig.m_caPrefix));
std::string caInfo = "";
if (caConfig.m_caInfo == "") {
- caInfo = "Issued by " + certificate.getSignature().getKeyLocator().getName().toUri();
+ caInfo = "Issued by " + certificate.getSignatureInfo().getKeyLocator().getName().toUri();
}
else {
caInfo = caConfig.m_caInfo;
@@ -73,7 +73,7 @@
break;
case tlv_ca_certificate:
item.parse();
- result.m_cert = std::make_shared<security::v2::Certificate>(item.get(tlv::Data));
+ result.m_cert = std::make_shared<security::Certificate>(item.get(tlv::Data));
break;
default:
continue;
diff --git a/src/protocol-detail/info.hpp b/src/protocol-detail/info.hpp
index 571d120..d34c0a2 100644
--- a/src/protocol-detail/info.hpp
+++ b/src/protocol-detail/info.hpp
@@ -32,7 +32,7 @@
* Encode CA configuration and its certificate into a TLV block as INFO Data packet content.
*/
static Block
- encodeDataContent(const CaProfile& caConfig, const security::v2::Certificate& certificate);
+ encodeDataContent(const CaProfile& caConfig, const security::Certificate& certificate);
/**
* Decode CA configuration from the TLV block of INFO Data packet content.
diff --git a/src/protocol-detail/new-renew-revoke.cpp b/src/protocol-detail/new-renew-revoke.cpp
index b368c8c..3ce3ac0 100644
--- a/src/protocol-detail/new-renew-revoke.cpp
+++ b/src/protocol-detail/new-renew-revoke.cpp
@@ -31,7 +31,7 @@
_LOG_INIT(ndncert.encoding.new_renew_revoke);
Block
-NEW_RENEW_REVOKE::encodeApplicationParameters(RequestType requestType, const std::string& ecdhPub, const security::v2::Certificate& certRequest)
+NEW_RENEW_REVOKE::encodeApplicationParameters(RequestType requestType, const std::string& ecdhPub, const security::Certificate& certRequest)
{
Block request = makeEmptyBlock(tlv::ApplicationParameters);
std::stringstream ss;
@@ -57,7 +57,7 @@
void
NEW_RENEW_REVOKE::decodeApplicationParameters(const Block& payload, RequestType requestType, std::string& ecdhPub,
- shared_ptr<security::v2::Certificate>& clientCert) {
+ shared_ptr<security::Certificate>& clientCert) {
payload.parse();
ecdhPub = readString(payload.get(tlv_ecdh_pub));
@@ -70,8 +70,8 @@
}
requestPayload.parse();
- security::v2::Certificate cert = security::v2::Certificate(requestPayload.get(tlv::Data));
- clientCert = make_shared<security::v2::Certificate>(cert);
+ security::Certificate cert = security::Certificate(requestPayload.get(tlv::Data));
+ clientCert = make_shared<security::Certificate>(cert);
}
Block
diff --git a/src/protocol-detail/new-renew-revoke.hpp b/src/protocol-detail/new-renew-revoke.hpp
index de5d558..f9710b8 100644
--- a/src/protocol-detail/new-renew-revoke.hpp
+++ b/src/protocol-detail/new-renew-revoke.hpp
@@ -29,10 +29,10 @@
class NEW_RENEW_REVOKE {
public:
static Block
- encodeApplicationParameters(RequestType requestType, const std::string& ecdhPub, const security::v2::Certificate& certRequest);
+ encodeApplicationParameters(RequestType requestType, const std::string& ecdhPub, const security::Certificate& certRequest);
static void
- decodeApplicationParameters(const Block& block, RequestType requestType, std::string& ecdhPub, shared_ptr<security::v2::Certificate>& certRequest);
+ decodeApplicationParameters(const Block& block, RequestType requestType, std::string& ecdhPub, shared_ptr<security::Certificate>& certRequest);
static Block
encodeDataContent(const std::string& ecdhKey, const std::string& salt,
diff --git a/src/protocol-detail/probe.cpp b/src/protocol-detail/probe.cpp
index d2f9e7e..b0ac75c 100644
--- a/src/protocol-detail/probe.cpp
+++ b/src/protocol-detail/probe.cpp
@@ -50,7 +50,7 @@
Block
PROBE::encodeDataContent(const std::vector<Name>& identifiers, boost::optional<size_t> maxSuffixLength,
- boost::optional<std::vector<std::shared_ptr<security::v2::Certificate>>> redirectionItems)
+ boost::optional<std::vector<std::shared_ptr<security::Certificate>>> redirectionItems)
{
Block content = makeEmptyBlock(tlv::Content);
for (const auto& name : identifiers) {
diff --git a/src/protocol-detail/probe.hpp b/src/protocol-detail/probe.hpp
index 6e19bab..7d61461 100644
--- a/src/protocol-detail/probe.hpp
+++ b/src/protocol-detail/probe.hpp
@@ -40,7 +40,7 @@
static Block
encodeDataContent(const std::vector<Name>& identifiers,
boost::optional<size_t> maxSuffixLength = boost::none,
- boost::optional<std::vector<std::shared_ptr<security::v2::Certificate>>> redirectionItems = boost::none);
+ boost::optional<std::vector<std::shared_ptr<security::Certificate>>> redirectionItems = boost::none);
static std::vector<std::tuple<std::string, std::string>>
decodeApplicationParameters(const Block& block);
diff --git a/src/requester.cpp b/src/requester.cpp
index 22c9d27..0b5a6c5 100644
--- a/src/requester.cpp
+++ b/src/requester.cpp
@@ -40,7 +40,7 @@
_LOG_INIT(ndncert.client);
-RequesterState::RequesterState(security::v2::KeyChain& keyChain, const CaProfile& caItem, RequestType requestType)
+RequesterState::RequesterState(security::KeyChain& keyChain, const CaProfile& caItem, RequestType requestType)
: m_caItem(caItem)
, m_keyChain(keyChain)
, m_type(requestType)
@@ -85,7 +85,7 @@
{
auto caItem = INFO::decodeDataContent(reply.getContent());
auto certBlock = caItem.m_cert->wireEncode();
- caItem.m_cert = std::make_shared<security::v2::Certificate>(certBlock);
+ caItem.m_cert = std::make_shared<security::Certificate>(certBlock);
if (caItem.m_cert->getFullName() != caCertFullName) {
_LOG_ERROR("Ca profile does not match the certificate information offered by the original CA.");
BOOST_THROW_EXCEPTION(std::runtime_error("Cannot verify replied Data packet signature."));
@@ -156,7 +156,7 @@
auto& keyName = state.m_keyPair.getName();
// generate certificate request
- security::v2::Certificate certRequest;
+ security::Certificate certRequest;
certRequest.setName(Name(keyName).append("cert-request").appendVersion());
certRequest.setContentType(tlv::ContentType_Key);
certRequest.setContent(state.m_keyPair.getPublicKey().data(), state.m_keyPair.getPublicKey().size());
@@ -179,7 +179,7 @@
}
shared_ptr<Interest>
-Requester::genRevokeInterest(RequesterState& state, const security::v2::Certificate& certificate)
+Requester::genRevokeInterest(RequesterState& state, const security::Certificate& certificate)
{
if (!state.m_caItem.m_caPrefix.isPrefixOf(certificate.getName())) {
return nullptr;
@@ -290,11 +290,11 @@
return interest;
}
-shared_ptr<security::v2::Certificate>
+shared_ptr<security::Certificate>
Requester::onCertFetchResponse(const Data& reply)
{
try {
- return std::make_shared<security::v2::Certificate>(reply);
+ return std::make_shared<security::Certificate>(reply);
}
catch (const std::exception& e) {
_LOG_ERROR("Cannot parse replied certificate ");
diff --git a/src/requester.hpp b/src/requester.hpp
index c6510b1..1b64d4b 100644
--- a/src/requester.hpp
+++ b/src/requester.hpp
@@ -34,7 +34,7 @@
struct RequesterState {
explicit
- RequesterState(security::v2::KeyChain& keyChain, const CaProfile& caItem, RequestType requestType);
+ RequesterState(security::KeyChain& keyChain, const CaProfile& caItem, RequestType requestType);
/**
* The CA profile for this request.
@@ -43,7 +43,7 @@
/**
* The local keychain to generate and install identities, keys and certificates
*/
- security::v2::KeyChain& m_keyChain;
+ security::KeyChain& m_keyChain;
/**
* The type of request. Either NEW, RENEW, or REVOKE.
*/
@@ -181,7 +181,7 @@
* @return The shared pointer to the encoded interest.
*/
static shared_ptr<Interest>
- genRevokeInterest(RequesterState& state, const security::v2::Certificate& certificate);
+ genRevokeInterest(RequesterState& state, const security::Certificate& certificate);
/**
* Decodes the replied data of NEW, RENEW, or REVOKE interest from the CA.
@@ -236,7 +236,7 @@
* @param reply, the data replied from the certificate fetch interest.
* @return The shared pointer to the certificate being fetched.
*/
- static shared_ptr<security::v2::Certificate>
+ static shared_ptr<security::Certificate>
onCertFetchResponse(const Data& reply);
/**
diff --git a/tests/identity-management-fixture.cpp b/tests/identity-management-fixture.cpp
index 84e1492..c3d6727 100644
--- a/tests/identity-management-fixture.cpp
+++ b/tests/identity-management-fixture.cpp
@@ -20,7 +20,7 @@
*/
#include "identity-management-fixture.hpp"
-#include <ndn-cxx/security/v2/additional-description.hpp>
+#include <ndn-cxx/security/additional-description.hpp>
#include <ndn-cxx/util/io.hpp>
#include <boost/filesystem.hpp>
diff --git a/tests/identity-management-fixture.hpp b/tests/identity-management-fixture.hpp
index 0400553..063c7ae 100644
--- a/tests/identity-management-fixture.hpp
+++ b/tests/identity-management-fixture.hpp
@@ -22,7 +22,7 @@
#ifndef NDN_TESTS_IDENTITY_MANAGEMENT_FIXTURE_HPP
#define NDN_TESTS_IDENTITY_MANAGEMENT_FIXTURE_HPP
-#include <ndn-cxx/security/v2/key-chain.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
#include <ndn-cxx/security/signing-helpers.hpp>
#include <vector>
@@ -60,7 +60,7 @@
*/
security::Identity
addIdentity(const Name& identityName,
- const KeyParams& params = security::v2::KeyChain::getDefaultKeyParams());
+ const KeyParams& params = security::KeyChain::getDefaultKeyParams());
/**
* @brief Save identity certificate to a file
@@ -82,12 +82,12 @@
*/
security::Identity
addSubCertificate(const Name& subIdentityName, const security::Identity& issuer,
- const KeyParams& params = security::v2::KeyChain::getDefaultKeyParams());
+ const KeyParams& params = security::KeyChain::getDefaultKeyParams());
/**
* @brief Add a self-signed certificate to @p key with issuer ID @p issuer
*/
- security::v2::Certificate
+ security::Certificate
addCertificate(const security::Key& key, const std::string& issuer);
protected:
diff --git a/tests/unit-tests/bench.t.cpp b/tests/unit-tests/bench.t.cpp
index 13adf8c..1766a18 100644
--- a/tests/unit-tests/bench.t.cpp
+++ b/tests/unit-tests/bench.t.cpp
@@ -101,7 +101,7 @@
// generate NEW Interest
CaProfile item;
item.m_caPrefix = Name("/ndn");
- item.m_cert = std::make_shared<security::v2::Certificate>(cert);
+ item.m_cert = std::make_shared<security::Certificate>(cert);
RequesterState state(m_keyChain, item, RequestType::NEW);
auto newInterest = Requester::genNewInterest(state, Name("/ndn/alice"),
time::system_clock::now(),
diff --git a/tests/unit-tests/ca-module.t.cpp b/tests/unit-tests/ca-module.t.cpp
index a7b9875..9f7d53a 100644
--- a/tests/unit-tests/ca-module.t.cpp
+++ b/tests/unit-tests/ca-module.t.cpp
@@ -206,8 +206,8 @@
}
}
BOOST_CHECK_EQUAL(redirectionItems.size(), 2);
- BOOST_CHECK_EQUAL(security::v2::extractIdentityFromCertName(redirectionItems[0].getPrefix(-1)), "/ndn/site1");
- BOOST_CHECK_EQUAL(security::v2::extractIdentityFromCertName(redirectionItems[1].getPrefix(-1)), "/ndn/site1");
+ BOOST_CHECK_EQUAL(security::extractIdentityFromCertName(redirectionItems[0].getPrefix(-1)), "/ndn/site1");
+ BOOST_CHECK_EQUAL(security::extractIdentityFromCertName(redirectionItems[1].getPrefix(-1)), "/ndn/site1");
});
face.receive(interest);
advanceClocks(time::milliseconds(20), 60);
@@ -226,7 +226,7 @@
CaProfile item;
item.m_caPrefix = Name("/ndn");
- item.m_cert = std::make_shared<security::v2::Certificate>(cert);
+ item.m_cert = std::make_shared<security::Certificate>(cert);
RequesterState state(m_keyChain, item, RequestType::NEW);
auto interest = Requester::genNewInterest(state, Name("/ndn/zhiyi"),
time::system_clock::now(),
@@ -275,7 +275,7 @@
CaProfile item;
item.m_caPrefix = Name("/ndn");
- item.m_cert = std::make_shared<security::v2::Certificate>(cert);
+ item.m_cert = std::make_shared<security::Certificate>(cert);
RequesterState state(m_keyChain, item, RequestType::NEW);
auto current_tp = time::system_clock::now();
auto interest1 = Requester::genNewInterest(state, Name("/ndn/zhiyi"), current_tp, current_tp - time::hours(1));
@@ -306,7 +306,7 @@
CaProfile item;
item.m_caPrefix = Name("/ndn");
- item.m_cert = std::make_shared<security::v2::Certificate>(cert);
+ item.m_cert = std::make_shared<security::Certificate>(cert);
RequesterState state(m_keyChain, item, RequestType::NEW);
auto interest1 = Requester::genNewInterest(state, Name("/ndn/a"), time::system_clock::now(),
@@ -347,7 +347,7 @@
CaProfile item;
item.m_caPrefix = Name("/ndn");
- item.m_cert = std::make_shared<security::v2::Certificate>(cert);
+ item.m_cert = std::make_shared<security::Certificate>(cert);
RequesterState state(m_keyChain, item, RequestType::NEW);
auto current_tp = time::system_clock::now();
@@ -378,7 +378,7 @@
// generate NEW Interest
CaProfile item;
item.m_caPrefix = Name("/ndn");
- item.m_cert = std::make_shared<security::v2::Certificate>(cert);
+ item.m_cert = std::make_shared<security::Certificate>(cert);
RequesterState state(m_keyChain, item, RequestType::NEW);
auto newInterest = Requester::genNewInterest(state, Name("/ndn/zhiyi"), time::system_clock::now(),
@@ -453,7 +453,7 @@
//generate a certificate
auto clientIdentity = m_keyChain.createIdentity("/ndn/qwerty");
auto clientKey = clientIdentity.getDefaultKey();
- security::v2::Certificate clientCert;
+ security::Certificate clientCert;
clientCert.setName(Name(clientKey.getName()).append("cert-request").appendVersion());
clientCert.setContentType(tlv::ContentType_Key);
clientCert.setFreshnessPeriod(time::hours(24));
@@ -467,7 +467,7 @@
CaProfile item;
item.m_caPrefix = Name("/ndn");
- item.m_cert = std::make_shared<security::v2::Certificate>(cert);
+ item.m_cert = std::make_shared<security::Certificate>(cert);
RequesterState state(m_keyChain, item, RequestType::REVOKE);
auto interest = Requester::genRevokeInterest(state, issuedCert);
@@ -516,7 +516,7 @@
// generate a certificate
auto clientIdentity = m_keyChain.createIdentity("/ndn/qwerty");
auto clientKey = clientIdentity.getDefaultKey();
- security::v2::Certificate clientCert;
+ security::Certificate clientCert;
clientCert.setName(Name(clientKey.getName()).append("NDNCERT").append(std::to_string(1473283247810732701)));
clientCert.setContentType(tlv::ContentType_Key);
clientCert.setFreshnessPeriod(time::hours(24));
@@ -528,7 +528,7 @@
CaProfile item;
item.m_caPrefix = Name("/ndn");
- item.m_cert = std::make_shared<security::v2::Certificate>(cert);
+ item.m_cert = std::make_shared<security::Certificate>(cert);
RequesterState state(m_keyChain, item, RequestType::NEW);
auto interest = Requester::genRevokeInterest(state, clientCert);
diff --git a/tests/unit-tests/challenge-credential.t.cpp b/tests/unit-tests/challenge-credential.t.cpp
index 236d274..46c5928 100644
--- a/tests/unit-tests/challenge-credential.t.cpp
+++ b/tests/unit-tests/challenge-credential.t.cpp
@@ -61,7 +61,7 @@
auto identityB = addIdentity(Name("/trust/cert"));
auto keyB = identityB.getDefaultKey();
auto credentialName = Name(keyB.getName()).append("Credential").appendVersion();
- security::v2::Certificate credential;
+ security::Certificate credential;
credential.setName(credentialName);
credential.setContent(keyB.getPublicKey().data(), keyB.getPublicKey().size());
SignatureInfo signatureInfo;
diff --git a/tests/unit-tests/requester.t.cpp b/tests/unit-tests/requester.t.cpp
index 8ac66c9..44a4b7f 100644
--- a/tests/unit-tests/requester.t.cpp
+++ b/tests/unit-tests/requester.t.cpp
@@ -44,7 +44,7 @@
ca_profile.m_probeParameterKeys.push_back("uid");
ca_profile.m_probeParameterKeys.push_back("name");
ca_profile.m_caPrefix = Name("/site");
- ca_profile.m_cert = std::make_shared<security::v2::Certificate>(cert);
+ ca_profile.m_cert = std::make_shared<security::Certificate>(cert);
std::vector<std::tuple<std::string, std::string>> probeParams;
probeParams.push_back(std::make_tuple("email", "zhiyi@cs.ucla.edu"));
@@ -68,7 +68,7 @@
ca_profile.m_probeParameterKeys.push_back("uid");
ca_profile.m_probeParameterKeys.push_back("name");
ca_profile.m_caPrefix = Name("/site");
- ca_profile.m_cert = std::make_shared<security::v2::Certificate>(cert);
+ ca_profile.m_cert = std::make_shared<security::Certificate>(cert);
std::vector<Name> availableNames;
availableNames.push_back(Name("/site1"));
@@ -92,8 +92,8 @@
BOOST_CHECK_EQUAL(names[1].toUri(), "/site2");
BOOST_CHECK_EQUAL(redirects.size(), 2);
- BOOST_CHECK_EQUAL(security::v2::extractIdentityFromCertName(redirects[0].getPrefix(-1)), "/ndn/site1");
- BOOST_CHECK_EQUAL(security::v2::extractIdentityFromCertName(redirects[1].getPrefix(-1)), "/ndn/site1");
+ BOOST_CHECK_EQUAL(security::extractIdentityFromCertName(redirects[0].getPrefix(-1)), "/ndn/site1");
+ BOOST_CHECK_EQUAL(security::extractIdentityFromCertName(redirects[1].getPrefix(-1)), "/ndn/site1");
}
BOOST_AUTO_TEST_CASE(ErrorHandling)
@@ -104,7 +104,7 @@
CaProfile item;
item.m_caPrefix = Name("/site");
- item.m_cert = std::make_shared<security::v2::Certificate>(cert);
+ item.m_cert = std::make_shared<security::Certificate>(cert);
RequesterState state(m_keyChain, item, RequestType::NEW);
Data errorPacket;
diff --git a/tools/ndncert-ca-server.cpp b/tools/ndncert-ca-server.cpp
index 281e7fe..be0c07d 100644
--- a/tools/ndncert-ca-server.cpp
+++ b/tools/ndncert-ca-server.cpp
@@ -33,7 +33,7 @@
namespace ndncert {
Face face;
-security::v2::KeyChain keyChain;
+security::KeyChain keyChain;
std::string repoHost = "localhost";
std::string repoPort = "7376";
diff --git a/tools/ndncert-client.cpp b/tools/ndncert-client.cpp
index 77cca60..d948854 100644
--- a/tools/ndncert-client.cpp
+++ b/tools/ndncert-client.cpp
@@ -43,7 +43,7 @@
size_t nStep = 1;
Face face;
-security::v2::KeyChain keyChain;
+security::KeyChain keyChain;
shared_ptr<RequesterState> requesterState = nullptr;
static void
@@ -217,7 +217,7 @@
<< "Step " << nStep++
<< ": Will use a new trust anchor, please double check the identity info:" << std::endl
<< "> New CA name: " << profile->m_caPrefix.toUri() << std::endl
- << "> This trust anchor information is signed by: " << reply.getSignature().getKeyLocator() << std::endl
+ << "> This trust anchor information is signed by: " << reply.getSignatureInfo().getKeyLocator() << std::endl
<< "> The certificate: " << profile->m_cert << std::endl
<< "Do you trust the information? Type in YES or NO" << std::endl;
@@ -252,7 +252,7 @@
std::cerr << "\nOr choose another trusted CA suggested by the CA: " << std::endl;
for (const auto& redirect : redirects) {
std::cerr << "> Index: " << count++ << std::endl
- << ">> Suggested CA: " << security::v2::extractIdentityFromCertName(redirect.getPrefix(-1)) << std::endl;
+ << ">> Suggested CA: " << security::extractIdentityFromCertName(redirect.getPrefix(-1)) << std::endl;
}
std::cerr << "Please type in the index of your choice:" << std::endl;
size_t index = 0;
@@ -277,7 +277,7 @@
else {
//redirects
auto redirectedCaFullName = redirects[index - names.size()];
- auto redirectedCaName = security::v2::extractIdentityFromCertName(redirectedCaFullName.getPrefix(-1));
+ auto redirectedCaName = security::extractIdentityFromCertName(redirectedCaFullName.getPrefix(-1));
std::cerr << "You selected to be redirected to CA: " << redirectedCaName.toUri() << std::endl;
face.expressInterest(
*Requester::genCaProfileDiscoveryInterest(redirectedCaName),