**breaking change**: Switch Face and related classes to v2::KeyChain
security::v2::KeyChain is now exposed as ndn::KeyChain, which should
ensure that dependent code can be mostly compiled. However, expect code
that explicitly uses the old KeyChain interface to be broken.
Change-Id: I7330d0250d92f3f0f2570ab6d0214ab3dfdd18cc
Refs: #3098
diff --git a/src/security/command-interest-signer.cpp b/src/security/command-interest-signer.cpp
index 0d2f82f..3704a7e 100644
--- a/src/security/command-interest-signer.cpp
+++ b/src/security/command-interest-signer.cpp
@@ -47,7 +47,7 @@
return name;
}
-CommandInterestSigner::CommandInterestSigner(v2::KeyChain& keyChain)
+CommandInterestSigner::CommandInterestSigner(KeyChain& keyChain)
: m_keyChain(keyChain)
{
}
diff --git a/src/security/command-interest-signer.hpp b/src/security/command-interest-signer.hpp
index 6c5e2ce..730260d 100644
--- a/src/security/command-interest-signer.hpp
+++ b/src/security/command-interest-signer.hpp
@@ -67,7 +67,7 @@
{
public:
explicit
- CommandInterestSigner(v2::KeyChain& keyChain);
+ CommandInterestSigner(KeyChain& keyChain);
/**
* @brief Create CommandInterest
@@ -82,10 +82,10 @@
* @sa https://redmine.named-data.net/projects/ndn-cxx/wiki/CommandInterest
*/
Interest
- makeCommandInterest(const Name& name, const SigningInfo& params = v2::KeyChain::getDefaultSigningInfo());
+ makeCommandInterest(const Name& name, const SigningInfo& params = KeyChain::getDefaultSigningInfo());
private:
- v2::KeyChain& m_keyChain;
+ KeyChain& m_keyChain;
};
} // namespace security
diff --git a/src/security/command-interest-validator.cpp b/src/security/command-interest-validator.cpp
index 73358bf..57c9c82 100644
--- a/src/security/command-interest-validator.cpp
+++ b/src/security/command-interest-validator.cpp
@@ -20,7 +20,6 @@
*/
#include "command-interest-validator.hpp"
-#include "v1/identity-certificate.hpp"
#include <boost/lexical_cast.hpp>
namespace ndn {
@@ -146,12 +145,14 @@
}
try {
- keyName = v1::IdentityCertificate::certificateNameToPublicKeyName(keyLocator.getName());
+ v2::extractIdentityFromKeyName(keyLocator.getName());
}
- catch (const v1::IdentityCertificate::Error&) {
+ catch (const std::invalid_argument&) {
return ErrorCode::BAD_CERT_NAME;
}
+ keyName = keyLocator.getName();
+
return ErrorCode::NONE;
}
diff --git a/src/security/key-chain.hpp b/src/security/key-chain.hpp
index 31b26ea..2bd847b 100644
--- a/src/security/key-chain.hpp
+++ b/src/security/key-chain.hpp
@@ -19,21 +19,10 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-/**
- * @file security/key-chain.hpp
- */
+#ifndef NDN_CXX_SECURITY_KEY_CHAIN_HPP
+#define NDN_CXX_SECURITY_KEY_CHAIN_HPP
#include "security-common.hpp"
-#include "v1/key-chain.hpp"
#include "v2/key-chain.hpp"
-namespace ndn {
-namespace security {
-
-using security::v1::KeyChain;
-
-} // namespace security
-
-using ndn::security::KeyChain;
-
-} // namespace ndn
+#endif // NDN_CXX_SECURITY_KEY_CHAIN_HPP
diff --git a/src/security/v2/key-chain.hpp b/src/security/v2/key-chain.hpp
index f0299c3..e564326 100644
--- a/src/security/v2/key-chain.hpp
+++ b/src/security/v2/key-chain.hpp
@@ -503,6 +503,9 @@
} // namespace v2
} // namespace security
+
+using security::v2::KeyChain;
+
} // namespace ndn
#endif // NDN_SECURITY_V2_KEY_CHAIN_HPP