Adjust includes for the updated locations of ndn-cxx security headers
Change-Id: I4b527581a97f706e348096b4d77c8f13559c9224
diff --git a/src/common.hpp b/src/common.hpp
index 7b9f977..0c762ce 100644
--- a/src/common.hpp
+++ b/src/common.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2019, Regents of the University of California
+ * Copyright (c) 2014-2020, 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
@@ -49,16 +49,16 @@
#include <ndn-cxx/ims/in-memory-storage-persistent.hpp>
#include <ndn-cxx/interest.hpp>
#include <ndn-cxx/link.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
#include <ndn-cxx/security/signing-helpers.hpp>
#include <ndn-cxx/security/transform/block-cipher.hpp>
#include <ndn-cxx/security/transform/buffer-source.hpp>
#include <ndn-cxx/security/transform/public-key.hpp>
#include <ndn-cxx/security/transform/stream-sink.hpp>
-#include <ndn-cxx/security/v2/key-chain.hpp>
-#include <ndn-cxx/security/v2/validation-callback.hpp>
-#include <ndn-cxx/security/v2/validation-error.hpp>
-#include <ndn-cxx/security/v2/validator.hpp>
+#include <ndn-cxx/security/validation-callback.hpp>
+#include <ndn-cxx/security/validation-error.hpp>
#include <ndn-cxx/security/validator-null.hpp>
+#include <ndn-cxx/security/validator.hpp>
#include <ndn-cxx/util/random.hpp>
#include <ndn-cxx/util/signal.hpp>
@@ -71,18 +71,18 @@
namespace ndn {
namespace nac {
+using security::Certificate;
+using security::DataValidationFailureCallback;
+using security::DataValidationSuccessCallback;
using security::Identity;
using security::Key;
-using security::SigningInfo;
using security::SafeBag;
+using security::SigningInfo;
+using security::ValidationError;
+using security::Validator;
using security::ValidatorNull;
+using security::extractKeyNameFromCertName;
using security::transform::PublicKey;
-using security::v2::Certificate;
-using security::v2::DataValidationFailureCallback;
-using security::v2::DataValidationSuccessCallback;
-using security::v2::ValidationError;
-using security::v2::Validator;
-using security::v2::extractKeyNameFromCertName;
namespace tlv {
using namespace ndn::tlv;
diff --git a/tests/identity-management-fixture.cpp b/tests/identity-management-fixture.cpp
index f8b9c35..847bb6b 100644
--- a/tests/identity-management-fixture.cpp
+++ b/tests/identity-management-fixture.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2018, Regents of the University of California
+ * Copyright (c) 2014-2020, 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
@@ -20,7 +20,7 @@
#include "identity-management-fixture.hpp"
#include <ndn-cxx/util/io.hpp>
-#include <ndn-cxx/security/v2/additional-description.hpp>
+#include <ndn-cxx/security/additional-description.hpp>
#include <boost/filesystem.hpp>
@@ -28,8 +28,6 @@
namespace nac {
namespace tests {
-namespace v2 = security::v2;
-
IdentityManagementFixture::IdentityManagementFixture()
: m_keyChain("pib-memory:", "tpm-memory:")
{
@@ -43,7 +41,7 @@
}
}
-security::Identity
+Identity
IdentityManagementFixture::addIdentity(const Name& identityName, const KeyParams& params)
{
auto identity = m_keyChain.createIdentity(identityName, params);
@@ -52,7 +50,7 @@
}
bool
-IdentityManagementFixture::saveIdentityCertificate(const security::Identity& identity,
+IdentityManagementFixture::saveIdentityCertificate(const Identity& identity,
const std::string& filename)
{
try {
@@ -64,13 +62,13 @@
}
}
-security::Identity
+Identity
IdentityManagementFixture::addSubCertificate(const Name& subIdentityName,
- const security::Identity& issuer, const KeyParams& params)
+ const Identity& issuer, const KeyParams& params)
{
auto subIdentity = addIdentity(subIdentityName, params);
- v2::Certificate request = subIdentity.getDefaultKey().getDefaultCertificate();
+ Certificate request = subIdentity.getDefaultKey().getDefaultCertificate();
request.setName(request.getKeyName().append("parent").appendVersion());
@@ -78,7 +76,7 @@
info.setValidityPeriod(security::ValidityPeriod(time::system_clock::now(),
time::system_clock::now() + time::days(7300)));
- v2::AdditionalDescription description;
+ security::AdditionalDescription description;
description.set("type", "sub-certificate");
info.appendTypeSpecificTlv(description.wireEncode());
@@ -88,14 +86,14 @@
return subIdentity;
}
-v2::Certificate
+Certificate
IdentityManagementFixture::addCertificate(const security::Key& key, const std::string& issuer)
{
Name certificateName = key.getName();
certificateName
.append(issuer)
.appendVersion();
- v2::Certificate certificate;
+ Certificate certificate;
certificate.setName(certificateName);
// set metainfo
diff --git a/tests/identity-management-fixture.hpp b/tests/identity-management-fixture.hpp
index 96cbc7f..d76e3fa 100644
--- a/tests/identity-management-fixture.hpp
+++ b/tests/identity-management-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2018, Regents of the University of California
+ * Copyright (c) 2014-2020, 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
@@ -20,9 +20,11 @@
#ifndef NAC_TESTS_IDENTITY_MANAGEMENT_FIXTURE_HPP
#define NAC_TESTS_IDENTITY_MANAGEMENT_FIXTURE_HPP
+#include "common.hpp"
+
#include "boost-test.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>
@@ -48,8 +50,8 @@
* @brief Add identity @p identityName
* @return name of the created self-signed certificate
*/
- security::Identity
- addIdentity(const Name& identityName, const KeyParams& params = security::v2::KeyChain::getDefaultKeyParams());
+ Identity
+ addIdentity(const Name& identityName, const KeyParams& params = KeyChain::getDefaultKeyParams());
/**
* @brief Save identity certificate to a file
@@ -58,7 +60,7 @@
* @return whether successful
*/
bool
- saveIdentityCertificate(const security::Identity& identity, const std::string& filename);
+ saveIdentityCertificate(const Identity& identity, const std::string& filename);
/**
* @brief Issue a certificate for \p subIdentityName signed by \p issuer
@@ -70,20 +72,20 @@
* @return the sub identity
*/
security::Identity
- addSubCertificate(const Name& subIdentityName, const security::Identity& issuer,
- const KeyParams& params = security::v2::KeyChain::getDefaultKeyParams());
+ addSubCertificate(const Name& subIdentityName, const Identity& issuer,
+ const KeyParams& params = KeyChain::getDefaultKeyParams());
/**
* @brief Add a self-signed certificate to @p key with issuer ID @p issuer
*/
- security::v2::Certificate
- addCertificate(const security::Key& key, const std::string& issuer);
+ Certificate
+ addCertificate(const Key& key, const std::string& issuer);
bool
saveCertToFile(const Data& obj, const std::string& filename);
protected:
- security::v2::KeyChain m_keyChain;
+ KeyChain m_keyChain;
std::set<Name> m_identities;
std::set<std::string> m_certFiles;
};
diff --git a/tools/ndn-nac/add-member.cpp b/tools/ndn-nac/add-member.cpp
index cc8455c..c6d0347 100644
--- a/tools/ndn-nac/add-member.cpp
+++ b/tools/ndn-nac/add-member.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2018, Regents of the University of California
+ * Copyright (c) 2014-2020, 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
@@ -80,8 +80,8 @@
output = "-";
try {
- security::v2::KeyChain keyChain;
- security::Identity id = keyChain.getPib().getIdentity(identityName);
+ KeyChain keyChain;
+ Identity id = keyChain.getPib().getIdentity(identityName);
auto cert = loadCertificate(member);
diff --git a/tools/ndn-nac/dump-kek.cpp b/tools/ndn-nac/dump-kek.cpp
index 5d3c35e..afc8047 100644
--- a/tools/ndn-nac/dump-kek.cpp
+++ b/tools/ndn-nac/dump-kek.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2018, Regents of the University of California
+ * Copyright (c) 2014-2020, 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
@@ -71,8 +71,8 @@
output = "-";
try {
- security::v2::KeyChain keyChain;
- security::Identity id = keyChain.getPib().getIdentity(identityName);
+ KeyChain keyChain;
+ Identity id = keyChain.getPib().getIdentity(identityName);
util::DummyClientFace face(keyChain); // to avoid any real IO
AccessManager manager(id, datasetName, keyChain, face);
diff --git a/tools/ndn-nac/ndn-nac.hpp b/tools/ndn-nac/ndn-nac.hpp
index 3f70bbd..5c8fd85 100644
--- a/tools/ndn-nac/ndn-nac.hpp
+++ b/tools/ndn-nac/ndn-nac.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2018, Regents of the University of California
+ * Copyright (c) 2014-2020, 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
@@ -44,14 +44,14 @@
int
nac_add_member(int argc, char** argv);
-inline security::v2::Certificate
+inline Certificate
loadCertificate(const std::string& fileName)
{
- shared_ptr<security::v2::Certificate> cert;
+ shared_ptr<Certificate> cert;
if (fileName == "-")
- cert = io::load<security::v2::Certificate>(std::cin);
+ cert = io::load<Certificate>(std::cin);
else
- cert = io::load<security::v2::Certificate>(fileName);
+ cert = io::load<Certificate>(fileName);
if (cert == nullptr) {
BOOST_THROW_EXCEPTION(std::runtime_error("Cannot load certificate from " + fileName));