Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
Davide Pesavento | 82d6a4c | 2017-12-23 19:47:20 -0500 | [diff] [blame] | 2 | /* |
Davide Pesavento | 809f754 | 2021-03-24 18:53:05 -0400 | [diff] [blame] | 3 | * Copyright (c) 2013-2021 Regents of the University of California. |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 4 | * |
| 5 | * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). |
| 6 | * |
| 7 | * ndn-cxx library is free software: you can redistribute it and/or modify it under the |
| 8 | * terms of the GNU Lesser General Public License as published by the Free Software |
| 9 | * Foundation, either version 3 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY |
| 12 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
| 13 | * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received copies of the GNU General Public License and GNU Lesser |
| 16 | * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see |
| 17 | * <http://www.gnu.org/licenses/>. |
| 18 | * |
| 19 | * See AUTHORS.md for complete list of ndn-cxx authors and contributors. |
| 20 | */ |
| 21 | |
Alexander Afanasyev | 09236c2 | 2020-06-03 13:42:38 -0400 | [diff] [blame] | 22 | #include "ndn-cxx/security/key-chain.hpp" |
laqinfan | 56a812d | 2019-06-03 15:33:58 -0500 | [diff] [blame] | 23 | #include "ndn-cxx/security/transform/private-key.hpp" |
Davide Pesavento | 4c1ad4c | 2020-11-16 21:12:02 -0500 | [diff] [blame] | 24 | #include "ndn-cxx/security/verification-helpers.hpp" |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 25 | |
Davide Pesavento | 7e78064 | 2018-11-24 15:51:34 -0500 | [diff] [blame] | 26 | #include "tests/boost-test.hpp" |
Davide Pesavento | 4c1ad4c | 2020-11-16 21:12:02 -0500 | [diff] [blame] | 27 | #include "tests/key-chain-fixture.hpp" |
Davide Pesavento | 7e78064 | 2018-11-24 15:51:34 -0500 | [diff] [blame] | 28 | #include "tests/unit/test-home-env-saver.hpp" |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 29 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 30 | #include <boost/mpl/vector.hpp> |
| 31 | |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 32 | namespace ndn { |
| 33 | namespace security { |
Alexander Afanasyev | 09236c2 | 2020-06-03 13:42:38 -0400 | [diff] [blame] | 34 | inline namespace v2 { |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 35 | namespace tests { |
| 36 | |
| 37 | using namespace ndn::tests; |
| 38 | |
| 39 | BOOST_AUTO_TEST_SUITE(Security) |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 40 | BOOST_FIXTURE_TEST_SUITE(TestKeyChain, TestHomeEnvSaver) |
| 41 | |
| 42 | template<class Path> |
| 43 | class TestHomeAndPibFixture : public TestHomeFixture<Path> |
| 44 | { |
| 45 | public: |
| 46 | TestHomeAndPibFixture() |
| 47 | { |
| 48 | unsetenv("NDN_CLIENT_PIB"); |
| 49 | unsetenv("NDN_CLIENT_TPM"); |
| 50 | } |
Alexander Afanasyev | 80782e0 | 2017-01-04 13:16:54 -0800 | [diff] [blame] | 51 | |
| 52 | ~TestHomeAndPibFixture() |
| 53 | { |
Alexander Afanasyev | 57d02b6 | 2018-06-15 18:19:50 -0400 | [diff] [blame] | 54 | try { |
| 55 | const_cast<std::string&>(KeyChain::getDefaultPibLocator()).clear(); |
| 56 | } |
| 57 | catch (const KeyChain::Error&) { |
| 58 | // ignore |
| 59 | } |
| 60 | |
| 61 | try { |
| 62 | const_cast<std::string&>(KeyChain::getDefaultTpmLocator()).clear(); |
| 63 | } |
| 64 | catch (const KeyChain::Error&) { |
| 65 | // ignore |
| 66 | } |
Alexander Afanasyev | 80782e0 | 2017-01-04 13:16:54 -0800 | [diff] [blame] | 67 | } |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 68 | }; |
| 69 | |
| 70 | struct PibPathConfigFileHome |
| 71 | { |
| 72 | const std::string PATH = "build/config-file-home/"; |
| 73 | }; |
| 74 | |
| 75 | BOOST_FIXTURE_TEST_CASE(ConstructorNormalConfig, TestHomeAndPibFixture<PibPathConfigFileHome>) |
| 76 | { |
| 77 | createClientConf({"pib=pib-memory:", "tpm=tpm-memory:"}); |
| 78 | |
| 79 | BOOST_REQUIRE_NO_THROW(KeyChain()); |
| 80 | |
| 81 | KeyChain keyChain; |
| 82 | BOOST_CHECK_EQUAL(keyChain.getPib().getPibLocator(), "pib-memory:"); |
| 83 | BOOST_CHECK_EQUAL(keyChain.getPib().getTpmLocator(), "tpm-memory:"); |
| 84 | BOOST_CHECK_EQUAL(keyChain.getTpm().getTpmLocator(), "tpm-memory:"); |
| 85 | } |
| 86 | |
| 87 | struct PibPathConfigFileEmptyHome |
| 88 | { |
| 89 | const std::string PATH = "build/config-file-empty-home/"; |
| 90 | }; |
| 91 | |
| 92 | BOOST_FIXTURE_TEST_CASE(ConstructorEmptyConfig, TestHomeAndPibFixture<PibPathConfigFileEmptyHome>) |
| 93 | { |
| 94 | createClientConf({"pib=pib-memory:"}); |
| 95 | |
Alexander Afanasyev | 0cf887d | 2017-03-26 16:58:59 -0500 | [diff] [blame] | 96 | #if defined(NDN_CXX_HAVE_OSX_FRAMEWORKS) |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 97 | std::string oldHOME; |
| 98 | if (std::getenv("OLD_HOME")) |
| 99 | oldHOME = std::getenv("OLD_HOME"); |
| 100 | |
| 101 | std::string HOME; |
| 102 | if (std::getenv("HOME")) |
| 103 | HOME = std::getenv("HOME"); |
| 104 | |
| 105 | if (!oldHOME.empty()) |
| 106 | setenv("HOME", oldHOME.c_str(), 1); |
| 107 | else |
| 108 | unsetenv("HOME"); |
| 109 | #endif |
| 110 | |
| 111 | BOOST_REQUIRE_NO_THROW(KeyChain()); |
| 112 | KeyChain keyChain; |
| 113 | BOOST_CHECK_EQUAL(keyChain.getPib().getPibLocator(), "pib-memory:"); |
| 114 | |
Alexander Afanasyev | 0cf887d | 2017-03-26 16:58:59 -0500 | [diff] [blame] | 115 | #if defined(NDN_CXX_HAVE_OSX_FRAMEWORKS) |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 116 | BOOST_CHECK_EQUAL(keyChain.getPib().getTpmLocator(), "tpm-osxkeychain:"); |
| 117 | BOOST_CHECK_EQUAL(keyChain.getTpm().getTpmLocator(), "tpm-osxkeychain:"); |
| 118 | #else |
| 119 | BOOST_CHECK_EQUAL(keyChain.getPib().getTpmLocator(), "tpm-file:"); |
| 120 | BOOST_CHECK_EQUAL(keyChain.getTpm().getTpmLocator(), "tpm-file:"); |
| 121 | #endif |
| 122 | |
Alexander Afanasyev | 0cf887d | 2017-03-26 16:58:59 -0500 | [diff] [blame] | 123 | #if defined(NDN_CXX_HAVE_OSX_FRAMEWORKS) |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 124 | if (!HOME.empty()) |
| 125 | setenv("HOME", HOME.c_str(), 1); |
| 126 | else |
| 127 | unsetenv("HOME"); |
| 128 | |
| 129 | if (!oldHOME.empty()) |
| 130 | setenv("OLD_HOME", oldHOME.c_str(), 1); |
| 131 | else |
| 132 | unsetenv("OLD_HOME"); |
| 133 | #endif |
| 134 | } |
| 135 | |
| 136 | struct PibPathConfigFileEmpty2Home |
| 137 | { |
| 138 | const std::string PATH = "build/config-file-empty2-home/"; |
| 139 | }; |
| 140 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 141 | BOOST_FIXTURE_TEST_CASE(ConstructorEmptyConfig2, TestHomeAndPibFixture<PibPathConfigFileEmpty2Home>) |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 142 | { |
| 143 | createClientConf({"tpm=tpm-memory:"}); |
| 144 | |
| 145 | BOOST_REQUIRE_NO_THROW(KeyChain()); |
| 146 | |
| 147 | KeyChain keyChain; |
| 148 | BOOST_CHECK_EQUAL(keyChain.getPib().getPibLocator(), "pib-sqlite3:"); |
| 149 | BOOST_CHECK_EQUAL(keyChain.getPib().getTpmLocator(), "tpm-memory:"); |
| 150 | BOOST_CHECK_EQUAL(keyChain.getTpm().getTpmLocator(), "tpm-memory:"); |
| 151 | } |
| 152 | |
| 153 | struct PibPathConfigFileMalformedHome |
| 154 | { |
| 155 | const std::string PATH = "build/config-file-malformed-home/"; |
| 156 | }; |
| 157 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 158 | BOOST_FIXTURE_TEST_CASE(ConstructorBadConfig, TestHomeAndPibFixture<PibPathConfigFileMalformedHome>) |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 159 | { |
| 160 | createClientConf({"pib=lord", "tpm=ring"}); |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 161 | BOOST_CHECK_THROW(KeyChain(), KeyChain::Error); // Wrong configuration. Error expected. |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 162 | } |
| 163 | |
| 164 | struct PibPathConfigFileMalformed2Home |
| 165 | { |
| 166 | const std::string PATH = "build/config-file-malformed2-home/"; |
| 167 | }; |
| 168 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 169 | BOOST_FIXTURE_TEST_CASE(ConstructorBadConfig2, TestHomeAndPibFixture<PibPathConfigFileMalformed2Home>) |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 170 | { |
| 171 | createClientConf({"pib=pib-sqlite3:%PATH%", "tpm=just-wrong"}); |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 172 | BOOST_CHECK_THROW(KeyChain(), KeyChain::Error); // Wrong configuration. Error expected. |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 173 | } |
| 174 | |
Alexander Afanasyev | 57d02b6 | 2018-06-15 18:19:50 -0400 | [diff] [blame] | 175 | struct PibPathConfigFileNonCanonicalTpm |
| 176 | { |
| 177 | const std::string PATH = "build/config-file-non-canonical-tpm/"; |
| 178 | }; |
| 179 | |
| 180 | BOOST_FIXTURE_TEST_CASE(ConstructorNonCanonicalTpm, TestHomeAndPibFixture<PibPathConfigFileNonCanonicalTpm>) // Bug 4297 |
| 181 | { |
| 182 | createClientConf({"pib=pib-sqlite3:", "tpm=tpm-file"}); |
| 183 | |
| 184 | { |
| 185 | KeyChain keyChain; |
| 186 | keyChain.createIdentity("/test"); |
| 187 | BOOST_CHECK_EQUAL(keyChain.getPib().getPibLocator(), "pib-sqlite3:"); |
| 188 | BOOST_CHECK_EQUAL(keyChain.getTpm().getTpmLocator(), "tpm-file:"); |
| 189 | } |
| 190 | |
| 191 | { |
| 192 | KeyChain keyChain; |
| 193 | BOOST_CHECK_EQUAL(keyChain.getPib().getPibLocator(), "pib-sqlite3:"); |
| 194 | BOOST_CHECK_EQUAL(keyChain.getTpm().getTpmLocator(), "tpm-file:"); |
| 195 | BOOST_CHECK(keyChain.getPib().getIdentities().find("/test") != keyChain.getPib().getIdentities().end()); |
| 196 | } |
| 197 | } |
| 198 | |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 199 | BOOST_AUTO_TEST_CASE(KeyChainWithCustomTpmAndPib) |
| 200 | { |
| 201 | BOOST_REQUIRE_NO_THROW((KeyChain("pib-memory", "tpm-memory"))); |
| 202 | BOOST_REQUIRE_NO_THROW((KeyChain("pib-memory:", "tpm-memory:"))); |
| 203 | BOOST_REQUIRE_NO_THROW((KeyChain("pib-memory:/something", "tpm-memory:/something"))); |
| 204 | |
| 205 | KeyChain keyChain("pib-memory", "tpm-memory"); |
| 206 | BOOST_CHECK_EQUAL(keyChain.getPib().getPibLocator(), "pib-memory:"); |
| 207 | BOOST_CHECK_EQUAL(keyChain.getPib().getTpmLocator(), "tpm-memory:"); |
| 208 | BOOST_CHECK_EQUAL(keyChain.getTpm().getTpmLocator(), "tpm-memory:"); |
| 209 | } |
| 210 | |
Davide Pesavento | 4c1ad4c | 2020-11-16 21:12:02 -0500 | [diff] [blame] | 211 | BOOST_FIXTURE_TEST_CASE(SigningWithCorruptedPibTpm, KeyChainFixture) |
Alexander Afanasyev | f601e19 | 2020-06-02 16:41:07 -0400 | [diff] [blame] | 212 | { |
| 213 | Identity id = m_keyChain.createIdentity("/test"); |
| 214 | |
| 215 | Data data("/foobar"); |
| 216 | BOOST_CHECK_NO_THROW(m_keyChain.sign(data, signingByIdentity(id))); |
| 217 | |
| 218 | // now, "corrupting TPM" |
| 219 | const_cast<Tpm&>(m_keyChain.getTpm()).deleteKey(id.getDefaultKey().getName()); |
| 220 | |
| 221 | BOOST_CHECK_NO_THROW(id.getDefaultKey()); |
| 222 | BOOST_CHECK_THROW(m_keyChain.sign(data, signingByIdentity(id)), KeyChain::InvalidSigningInfoError); |
| 223 | } |
| 224 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 225 | BOOST_FIXTURE_TEST_CASE(SigningWithNonExistingIdentity, KeyChainFixture) |
| 226 | { |
| 227 | Data data("/test/data"); |
| 228 | BOOST_CHECK_THROW(m_keyChain.sign(data, signingByIdentity("/non-existing/identity")), |
| 229 | KeyChain::InvalidSigningInfoError); |
| 230 | } |
| 231 | |
Davide Pesavento | 4c1ad4c | 2020-11-16 21:12:02 -0500 | [diff] [blame] | 232 | BOOST_FIXTURE_TEST_CASE(Management, KeyChainFixture) |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 233 | { |
| 234 | Name identityName("/test/id"); |
| 235 | Name identity2Name("/test/id2"); |
| 236 | |
| 237 | BOOST_CHECK_EQUAL(m_keyChain.getPib().getIdentities().size(), 0); |
| 238 | BOOST_REQUIRE_THROW(m_keyChain.getPib().getDefaultIdentity(), Pib::Error); |
| 239 | |
| 240 | // Create identity |
| 241 | Identity id = m_keyChain.createIdentity(identityName); |
| 242 | BOOST_CHECK(id); |
| 243 | BOOST_CHECK(m_keyChain.getPib().getIdentities().find(identityName) != m_keyChain.getPib().getIdentities().end()); |
| 244 | // The first added identity becomes the default identity |
laqinfan | 56a812d | 2019-06-03 15:33:58 -0500 | [diff] [blame] | 245 | BOOST_CHECK_NO_THROW(m_keyChain.getPib().getDefaultIdentity()); |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 246 | // The default key of the added identity must exist |
laqinfan | 56a812d | 2019-06-03 15:33:58 -0500 | [diff] [blame] | 247 | Key key = id.getDefaultKey(); |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 248 | // The default certificate of the default key must exist |
laqinfan | 56a812d | 2019-06-03 15:33:58 -0500 | [diff] [blame] | 249 | BOOST_CHECK_NO_THROW(key.getDefaultCertificate()); |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 250 | |
| 251 | // Delete key |
| 252 | Name key1Name = key.getName(); |
| 253 | BOOST_CHECK_NO_THROW(id.getKey(key1Name)); |
| 254 | BOOST_CHECK_EQUAL(id.getKeys().size(), 1); |
| 255 | m_keyChain.deleteKey(id, key); |
| 256 | // The key instance should not be valid any more |
| 257 | BOOST_CHECK(!key); |
| 258 | BOOST_CHECK_THROW(id.getKey(key1Name), Pib::Error); |
| 259 | BOOST_CHECK_EQUAL(id.getKeys().size(), 0); |
| 260 | |
| 261 | // Create another key |
| 262 | m_keyChain.createKey(id); |
| 263 | // The added key becomes the default key. |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 264 | Key key2 = id.getDefaultKey(); |
| 265 | BOOST_REQUIRE(key2); |
| 266 | BOOST_CHECK_NE(key2.getName(), key1Name); |
| 267 | BOOST_CHECK_EQUAL(id.getKeys().size(), 1); |
laqinfan | 56a812d | 2019-06-03 15:33:58 -0500 | [diff] [blame] | 268 | BOOST_CHECK_NO_THROW(key2.getDefaultCertificate()); |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 269 | |
| 270 | // Create the third key |
| 271 | Key key3 = m_keyChain.createKey(id); |
Junxiao Shi | 72c0c64 | 2018-04-20 15:41:09 +0000 | [diff] [blame] | 272 | BOOST_CHECK_NE(key3.getName(), key2.getName()); |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 273 | // The added key will not be the default key, because the default key already exists |
Junxiao Shi | 72c0c64 | 2018-04-20 15:41:09 +0000 | [diff] [blame] | 274 | BOOST_CHECK_EQUAL(id.getDefaultKey().getName(), key2.getName()); |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 275 | BOOST_CHECK_EQUAL(id.getKeys().size(), 2); |
laqinfan | 56a812d | 2019-06-03 15:33:58 -0500 | [diff] [blame] | 276 | BOOST_CHECK_NO_THROW(key3.getDefaultCertificate()); |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 277 | |
| 278 | // Delete cert |
| 279 | BOOST_CHECK_EQUAL(key3.getCertificates().size(), 1); |
| 280 | Certificate key3Cert1 = *key3.getCertificates().begin(); |
| 281 | Name key3CertName = key3Cert1.getName(); |
| 282 | m_keyChain.deleteCertificate(key3, key3CertName); |
| 283 | BOOST_CHECK_EQUAL(key3.getCertificates().size(), 0); |
| 284 | BOOST_REQUIRE_THROW(key3.getDefaultCertificate(), Pib::Error); |
| 285 | |
| 286 | // Add cert |
| 287 | m_keyChain.addCertificate(key3, key3Cert1); |
| 288 | BOOST_CHECK_EQUAL(key3.getCertificates().size(), 1); |
laqinfan | 56a812d | 2019-06-03 15:33:58 -0500 | [diff] [blame] | 289 | BOOST_CHECK_NO_THROW(key3.getDefaultCertificate()); |
Alexander Afanasyev | a10b2ff | 2017-01-30 12:44:15 -0800 | [diff] [blame] | 290 | m_keyChain.addCertificate(key3, key3Cert1); // overwriting the cert should work |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 291 | BOOST_CHECK_EQUAL(key3.getCertificates().size(), 1); |
| 292 | // Add another cert |
| 293 | Certificate key3Cert2 = key3Cert1; |
| 294 | Name key3Cert2Name = key3.getName(); |
| 295 | key3Cert2Name.append("Self"); |
| 296 | key3Cert2Name.appendVersion(); |
| 297 | key3Cert2.setName(key3Cert2Name); |
| 298 | m_keyChain.addCertificate(key3, key3Cert2); |
| 299 | BOOST_CHECK_EQUAL(key3.getCertificates().size(), 2); |
Davide Pesavento | 81bd696 | 2020-06-17 16:03:23 -0400 | [diff] [blame] | 300 | // Add empty cert |
| 301 | Certificate key3Cert3 = key3Cert1; |
| 302 | key3Cert3.unsetContent(); |
| 303 | BOOST_CHECK_THROW(m_keyChain.addCertificate(key3, key3Cert3), std::invalid_argument); |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 304 | |
| 305 | // Default certificate setting |
| 306 | BOOST_CHECK_EQUAL(key3.getDefaultCertificate().getName(), key3CertName); |
| 307 | m_keyChain.setDefaultCertificate(key3, key3Cert2); |
| 308 | BOOST_CHECK_EQUAL(key3.getDefaultCertificate().getName(), key3Cert2Name); |
| 309 | |
| 310 | // Default key setting |
| 311 | BOOST_CHECK_EQUAL(id.getDefaultKey().getName(), key2.getName()); |
| 312 | m_keyChain.setDefaultKey(id, key3); |
| 313 | BOOST_CHECK_EQUAL(id.getDefaultKey().getName(), key3.getName()); |
| 314 | |
| 315 | // Default identity setting |
| 316 | Identity id2 = m_keyChain.createIdentity(identity2Name); |
| 317 | BOOST_CHECK_EQUAL(m_keyChain.getPib().getDefaultIdentity().getName(), id.getName()); |
| 318 | m_keyChain.setDefaultIdentity(id2); |
| 319 | BOOST_CHECK_EQUAL(m_keyChain.getPib().getDefaultIdentity().getName(), id2.getName()); |
| 320 | |
| 321 | // Delete identity |
| 322 | m_keyChain.deleteIdentity(id); |
| 323 | // The identity instance should not be valid any more |
| 324 | BOOST_CHECK(!id); |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 325 | BOOST_CHECK_THROW(m_keyChain.getPib().getIdentity(identityName), Pib::Error); |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 326 | BOOST_CHECK(m_keyChain.getPib().getIdentities().find(identityName) == m_keyChain.getPib().getIdentities().end()); |
| 327 | } |
| 328 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 329 | struct DataPkt |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 330 | { |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 331 | Data packet{"/data"}; |
| 332 | SignedInterestFormat sigFormat = SignedInterestFormat::V02; // irrelevant for Data |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 333 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 334 | SignatureInfo |
| 335 | getSignatureInfo() const |
| 336 | { |
| 337 | return packet.getSignatureInfo(); |
| 338 | } |
| 339 | }; |
laqinfan | 56a812d | 2019-06-03 15:33:58 -0500 | [diff] [blame] | 340 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 341 | struct InterestV02Pkt |
| 342 | { |
| 343 | Interest packet = Interest{"/interest02"}.setCanBePrefix(false); |
| 344 | SignedInterestFormat sigFormat = SignedInterestFormat::V02; |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 345 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 346 | SignatureInfo |
| 347 | getSignatureInfo() const |
| 348 | { |
| 349 | return SignatureInfo(packet.getName()[signed_interest::POS_SIG_INFO].blockFromValue()); |
| 350 | } |
| 351 | }; |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 352 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 353 | struct InterestV03Pkt |
| 354 | { |
| 355 | Interest packet = Interest{"/interest03"}.setCanBePrefix(false); |
| 356 | SignedInterestFormat sigFormat = SignedInterestFormat::V03; |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 357 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 358 | SignatureInfo |
| 359 | getSignatureInfo() const |
| 360 | { |
| 361 | return packet.getSignatureInfo().value(); // use .value() for checked access |
| 362 | } |
| 363 | }; |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 364 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 365 | template<typename KeyParams> |
| 366 | struct DefaultIdentity |
| 367 | { |
| 368 | Identity |
| 369 | operator()(KeyChain& keyChain) const |
| 370 | { |
| 371 | auto id = keyChain.createIdentity("/id", KeyParams()); |
| 372 | BOOST_ASSERT(keyChain.getPib().getDefaultIdentity() == id); |
| 373 | return id; |
| 374 | } |
| 375 | }; |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 376 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 377 | template<typename KeyParams> |
| 378 | struct NonDefaultIdentity |
| 379 | { |
| 380 | Identity |
| 381 | operator()(KeyChain& keyChain) const |
| 382 | { |
| 383 | auto id = keyChain.createIdentity("/id"); |
| 384 | auto id2 = keyChain.createIdentity("/id2", KeyParams()); |
| 385 | BOOST_ASSERT(keyChain.getPib().getDefaultIdentity() == id); |
| 386 | return id2; |
| 387 | } |
| 388 | }; |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 389 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 390 | template<typename KeyParams> |
| 391 | struct DefaultKey |
| 392 | { |
| 393 | Key |
| 394 | operator()(KeyChain&, const Identity& id) const |
| 395 | { |
| 396 | auto key = id.getDefaultKey(); |
| 397 | BOOST_ASSERT(key.getKeyType() == KeyParams().getKeyType()); |
| 398 | return key; |
| 399 | } |
| 400 | }; |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 401 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 402 | template<typename KeyParams> |
| 403 | struct NonDefaultKey |
| 404 | { |
| 405 | Key |
| 406 | operator()(KeyChain& keyChain, const Identity& id) const |
| 407 | { |
| 408 | auto key2 = keyChain.createKey(id, KeyParams()); |
| 409 | BOOST_ASSERT(id.getDefaultKey() != key2); |
| 410 | return key2; |
| 411 | } |
| 412 | }; |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 413 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 414 | template<typename PacketType, |
| 415 | template<typename> class IdentityMaker = DefaultIdentity, |
| 416 | template<typename> class KeyMaker = DefaultKey, |
| 417 | typename AsymmetricKeyParams = EcKeyParams, |
| 418 | uint32_t SignatureTypeTlvValue = tlv::SignatureSha256WithEcdsa> |
| 419 | struct AsymmetricSigningBase : protected KeyChainFixture, protected PacketType |
| 420 | { |
| 421 | const Identity id = IdentityMaker<AsymmetricKeyParams>()(m_keyChain); |
| 422 | const Key key = KeyMaker<AsymmetricKeyParams>()(m_keyChain, id); |
| 423 | const Certificate cert = key.getDefaultCertificate(); |
| 424 | |
| 425 | const uint32_t expectedSigType = SignatureTypeTlvValue; |
| 426 | const bool shouldHaveKeyLocator = true; |
| 427 | const optional<KeyLocator> expectedKeyLocator = cert.getName().getPrefix(-2); |
| 428 | |
| 429 | bool |
| 430 | verify(const SigningInfo&) const |
| 431 | { |
| 432 | return verifySignature(this->packet, key); |
| 433 | } |
| 434 | }; |
| 435 | |
| 436 | template<typename PacketType, |
| 437 | typename AsymmetricKeyParams, |
| 438 | uint32_t SignatureTypeTlvValue> |
| 439 | struct AsymmetricSigning : protected AsymmetricSigningBase<PacketType, DefaultIdentity, DefaultKey, |
| 440 | AsymmetricKeyParams, SignatureTypeTlvValue> |
| 441 | { |
| 442 | const std::vector<SigningInfo> signingInfos = { |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 443 | SigningInfo(), |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 444 | SigningInfo(""), |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 445 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 446 | SigningInfo(this->id), |
| 447 | SigningInfo(SigningInfo::SIGNER_TYPE_ID, this->id.getName()), |
| 448 | SigningInfo("id:" + this->id.getName().toUri()), |
| 449 | signingByIdentity(this->id), |
| 450 | signingByIdentity(this->id.getName()), |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 451 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 452 | SigningInfo(this->key), |
| 453 | SigningInfo(SigningInfo::SIGNER_TYPE_KEY, this->key.getName()), |
| 454 | SigningInfo("key:" + this->key.getName().toUri()), |
| 455 | signingByKey(this->key), |
| 456 | signingByKey(this->key.getName()), |
Alexander Afanasyev | d6d78aa | 2017-01-02 18:14:23 -0800 | [diff] [blame] | 457 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 458 | SigningInfo(SigningInfo::SIGNER_TYPE_CERT, this->cert.getName()), |
| 459 | SigningInfo("cert:" + this->cert.getName().toUri()), |
| 460 | signingByCertificate(this->cert), |
| 461 | signingByCertificate(this->cert.getName()), |
| 462 | }; |
| 463 | }; |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 464 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 465 | template<typename PacketType> |
| 466 | using RsaSigning = AsymmetricSigning<PacketType, RsaKeyParams, tlv::SignatureSha256WithRsa>; |
Alexander Afanasyev | d6d78aa | 2017-01-02 18:14:23 -0800 | [diff] [blame] | 467 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 468 | template<typename PacketType> |
| 469 | using EcdsaSigning = AsymmetricSigning<PacketType, EcKeyParams, tlv::SignatureSha256WithEcdsa>; |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 470 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 471 | template<typename PacketType> |
| 472 | struct SigningWithNonDefaultIdentity : protected AsymmetricSigningBase<PacketType, NonDefaultIdentity> |
| 473 | { |
| 474 | const std::vector<SigningInfo> signingInfos = { |
| 475 | signingByIdentity(this->id), |
| 476 | signingByIdentity(this->id.getName()), |
| 477 | signingByKey(this->key), |
| 478 | signingByCertificate(this->cert), |
| 479 | }; |
| 480 | }; |
| 481 | |
| 482 | template<typename PacketType> |
| 483 | struct SigningWithNonDefaultKey : protected AsymmetricSigningBase<PacketType, NonDefaultIdentity, NonDefaultKey> |
| 484 | { |
| 485 | const std::vector<SigningInfo> signingInfos = { |
| 486 | signingByKey(this->key), |
| 487 | signingByKey(this->key.getName()), |
| 488 | signingByCertificate(this->cert), |
| 489 | }; |
| 490 | }; |
| 491 | |
| 492 | template<typename PacketType, |
| 493 | DigestAlgorithm DigestAlgo = DigestAlgorithm::SHA256, |
| 494 | uint32_t SignatureTypeTlvValue = tlv::SignatureHmacWithSha256> |
| 495 | struct HmacSigning : protected KeyChainFixture, protected PacketType |
| 496 | { |
| 497 | const std::vector<SigningInfo> signingInfos = { |
| 498 | SigningInfo(SigningInfo::SIGNER_TYPE_HMAC, m_keyChain.createHmacKey()), |
laqinfan | 56a812d | 2019-06-03 15:33:58 -0500 | [diff] [blame] | 499 | SigningInfo("hmac-sha256:QjM3NEEyNkE3MTQ5MDQzN0FBMDI0RTRGQURENUI0OTdGREZGMUE4RUE2RkYxMkY2RkI2NUFGMjcyMEI1OUNDRg=="), |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 500 | }; |
laqinfan | 56a812d | 2019-06-03 15:33:58 -0500 | [diff] [blame] | 501 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 502 | const uint32_t expectedSigType = SignatureTypeTlvValue; |
| 503 | const bool shouldHaveKeyLocator = true; |
| 504 | const optional<KeyLocator> expectedKeyLocator = nullopt; // don't check KeyLocator value |
| 505 | |
| 506 | bool |
| 507 | verify(const SigningInfo& si) const |
| 508 | { |
| 509 | return verifySignature(this->packet, m_keyChain.getTpm(), si.getSignerName(), DigestAlgo); |
| 510 | } |
| 511 | }; |
| 512 | |
| 513 | template<typename PacketType> |
| 514 | struct Sha256Signing : protected KeyChainFixture, protected PacketType |
| 515 | { |
| 516 | const std::vector<SigningInfo> signingInfos = { |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 517 | SigningInfo(SigningInfo::SIGNER_TYPE_SHA256), |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 518 | SigningInfo("id:" + SigningInfo::getDigestSha256Identity().toUri()), |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 519 | signingWithSha256() |
| 520 | }; |
| 521 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 522 | const uint32_t expectedSigType = tlv::DigestSha256; |
| 523 | const bool shouldHaveKeyLocator = false; |
| 524 | const optional<KeyLocator> expectedKeyLocator = nullopt; |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 525 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 526 | bool |
| 527 | verify(const SigningInfo&) const |
| 528 | { |
Davide Pesavento | 809f754 | 2021-03-24 18:53:05 -0400 | [diff] [blame] | 529 | return verifySignature(this->packet, nullopt); |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 530 | } |
| 531 | }; |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 532 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 533 | using SigningTests = boost::mpl::vector< |
| 534 | RsaSigning<DataPkt>, |
| 535 | RsaSigning<InterestV02Pkt>, |
| 536 | RsaSigning<InterestV03Pkt>, |
| 537 | EcdsaSigning<DataPkt>, |
| 538 | EcdsaSigning<InterestV02Pkt>, |
| 539 | EcdsaSigning<InterestV03Pkt>, |
| 540 | HmacSigning<DataPkt>, |
| 541 | HmacSigning<InterestV02Pkt>, |
| 542 | HmacSigning<InterestV03Pkt>, |
| 543 | Sha256Signing<DataPkt>, |
| 544 | Sha256Signing<InterestV02Pkt>, |
| 545 | Sha256Signing<InterestV03Pkt>, |
| 546 | SigningWithNonDefaultIdentity<DataPkt>, |
Davide Pesavento | 809f754 | 2021-03-24 18:53:05 -0400 | [diff] [blame] | 547 | SigningWithNonDefaultIdentity<InterestV03Pkt>, |
| 548 | SigningWithNonDefaultKey<DataPkt>, |
| 549 | SigningWithNonDefaultKey<InterestV03Pkt> |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 550 | >; |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 551 | |
Davide Pesavento | 7371036 | 2020-12-04 16:10:03 -0500 | [diff] [blame] | 552 | BOOST_FIXTURE_TEST_CASE_TEMPLATE(SigningInterface, T, SigningTests, T) |
| 553 | { |
| 554 | BOOST_TEST_CONTEXT("Packet = " << this->packet.getName()) { |
| 555 | for (auto signingInfo : this->signingInfos) { |
| 556 | signingInfo.setSignedInterestFormat(this->sigFormat); |
| 557 | |
| 558 | BOOST_TEST_CONTEXT("SigningInfo = " << signingInfo) { |
| 559 | this->m_keyChain.sign(this->packet, signingInfo); |
| 560 | |
| 561 | auto sigInfo = this->getSignatureInfo(); |
| 562 | BOOST_CHECK_EQUAL(sigInfo.getSignatureType(), this->expectedSigType); |
| 563 | BOOST_CHECK_EQUAL(sigInfo.hasKeyLocator(), this->shouldHaveKeyLocator); |
| 564 | if (this->expectedKeyLocator) { |
| 565 | BOOST_CHECK_EQUAL(sigInfo.getKeyLocator(), *this->expectedKeyLocator); |
| 566 | } |
| 567 | BOOST_CHECK(this->verify(signingInfo)); |
Eric Newberry | b74bbda | 2020-06-18 19:33:58 -0700 | [diff] [blame] | 568 | } |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 569 | } |
| 570 | } |
| 571 | } |
| 572 | |
Davide Pesavento | 4c1ad4c | 2020-11-16 21:12:02 -0500 | [diff] [blame] | 573 | BOOST_FIXTURE_TEST_CASE(ImportPrivateKey, KeyChainFixture) |
laqinfan | 56a812d | 2019-06-03 15:33:58 -0500 | [diff] [blame] | 574 | { |
| 575 | Name keyName("/test/device2"); |
| 576 | std::string rawKey("nPSNOHyZKsg2WLqHAs7MXGb0sjQb4zCT"); |
| 577 | auto key = make_shared<transform::PrivateKey>(); |
| 578 | key->loadRaw(KeyType::HMAC, reinterpret_cast<const uint8_t*>(rawKey.data()), rawKey.size()); |
| 579 | |
| 580 | m_keyChain.importPrivateKey(keyName, key); |
| 581 | BOOST_CHECK_EQUAL(m_keyChain.getTpm().hasKey(keyName), true); |
| 582 | BOOST_CHECK_THROW(m_keyChain.importPrivateKey(keyName, key), KeyChain::Error); |
| 583 | } |
| 584 | |
Davide Pesavento | 4c1ad4c | 2020-11-16 21:12:02 -0500 | [diff] [blame] | 585 | BOOST_FIXTURE_TEST_CASE(ExportImport, KeyChainFixture) |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 586 | { |
Davide Pesavento | 4c1ad4c | 2020-11-16 21:12:02 -0500 | [diff] [blame] | 587 | Identity id = m_keyChain.createIdentity("/TestKeyChain/ExportIdentity"); |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 588 | Certificate cert = id.getDefaultKey().getDefaultCertificate(); |
| 589 | |
| 590 | shared_ptr<SafeBag> exported = m_keyChain.exportSafeBag(cert, "1234", 4); |
| 591 | Block block = exported->wireEncode(); |
| 592 | |
| 593 | m_keyChain.deleteIdentity(id); |
Davide Pesavento | 82d6a4c | 2017-12-23 19:47:20 -0500 | [diff] [blame] | 594 | BOOST_CHECK_THROW(m_keyChain.exportSafeBag(cert, "1234", 4), KeyChain::Error); |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 595 | |
| 596 | BOOST_CHECK_EQUAL(m_keyChain.getTpm().hasKey(cert.getKeyName()), false); |
| 597 | BOOST_CHECK_EQUAL(m_keyChain.getPib().getIdentities().size(), 0); |
| 598 | |
| 599 | SafeBag imported; |
| 600 | imported.wireDecode(block); |
| 601 | m_keyChain.importSafeBag(imported, "1234", 4); |
Davide Pesavento | 82d6a4c | 2017-12-23 19:47:20 -0500 | [diff] [blame] | 602 | BOOST_CHECK_THROW(m_keyChain.importSafeBag(imported, "1234", 4), KeyChain::Error); |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 603 | |
| 604 | BOOST_CHECK_EQUAL(m_keyChain.getTpm().hasKey(cert.getKeyName()), true); |
| 605 | BOOST_CHECK_EQUAL(m_keyChain.getPib().getIdentities().size(), 1); |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 606 | Identity newId = m_keyChain.getPib().getIdentity(cert.getIdentity()); |
| 607 | BOOST_CHECK_EQUAL(newId.getKeys().size(), 1); |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 608 | Key newKey = newId.getKey(cert.getKeyName()); |
| 609 | BOOST_CHECK_EQUAL(newKey.getCertificates().size(), 1); |
laqinfan | 56a812d | 2019-06-03 15:33:58 -0500 | [diff] [blame] | 610 | BOOST_CHECK_NO_THROW(newKey.getCertificate(cert.getName())); |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 611 | |
| 612 | m_keyChain.deleteIdentity(newId); |
| 613 | BOOST_CHECK_EQUAL(m_keyChain.getPib().getIdentities().size(), 0); |
| 614 | BOOST_CHECK_EQUAL(m_keyChain.getTpm().hasKey(cert.getKeyName()), false); |
| 615 | } |
| 616 | |
Davide Pesavento | 4c1ad4c | 2020-11-16 21:12:02 -0500 | [diff] [blame] | 617 | BOOST_FIXTURE_TEST_CASE(SelfSignedCertValidity, KeyChainFixture) |
Alexander Afanasyev | f837917 | 2017-01-11 16:56:04 -0800 | [diff] [blame] | 618 | { |
Davide Pesavento | 4c1ad4c | 2020-11-16 21:12:02 -0500 | [diff] [blame] | 619 | Certificate cert = m_keyChain.createIdentity("/Security/TestKeyChain/SelfSignedCertValidity") |
Alexander Afanasyev | f837917 | 2017-01-11 16:56:04 -0800 | [diff] [blame] | 620 | .getDefaultKey() |
| 621 | .getDefaultCertificate(); |
| 622 | BOOST_CHECK(cert.isValid()); |
Davide Pesavento | 0f83080 | 2018-01-16 23:58:58 -0500 | [diff] [blame] | 623 | BOOST_CHECK(cert.isValid(time::system_clock::now() + 10 * 365_days)); |
| 624 | BOOST_CHECK_GT(cert.getValidityPeriod().getPeriod().second, time::system_clock::now() + 10 * 365_days); |
Alexander Afanasyev | f837917 | 2017-01-11 16:56:04 -0800 | [diff] [blame] | 625 | } |
| 626 | |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 627 | BOOST_AUTO_TEST_SUITE_END() // TestKeyChain |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 628 | BOOST_AUTO_TEST_SUITE_END() // Security |
| 629 | |
| 630 | } // namespace tests |
Alexander Afanasyev | 09236c2 | 2020-06-03 13:42:38 -0400 | [diff] [blame] | 631 | } // inline namespace v2 |
Yingdi Yu | fe4733a | 2015-10-22 14:24:12 -0700 | [diff] [blame] | 632 | } // namespace security |
| 633 | } // namespace ndn |