blob: aafaa8f53f3d030a48cd80174ffbd3f639e177e4 [file] [log] [blame]
Ashlesh Gawande6c86e302019-09-17 22:27:05 -05001diff --git a/ndn-cxx/security/v2/key-chain.cpp b/ndn-cxx/security/v2/key-chain.cpp
Ashlesh Gawandef48424a2020-04-04 16:58:41 -07002index 63f1d985..b8bdeb77 100644
Ashlesh Gawande6c86e302019-09-17 22:27:05 -05003--- a/ndn-cxx/security/v2/key-chain.cpp
4+++ b/ndn-cxx/security/v2/key-chain.cpp
Ashlesh Gawandef48424a2020-04-04 16:58:41 -07005@@ -40,6 +40,7 @@
6 #include "ndn-cxx/security/transform/private-key.hpp"
7 #include "ndn-cxx/security/transform/public-key.hpp"
8 #include "ndn-cxx/security/transform/verifier-filter.hpp"
Ashlesh Gawande6c86e302019-09-17 22:27:05 -05009+#include "ndn-cxx/util/dummy-keychain.hpp"
10
Ashlesh Gawandef48424a2020-04-04 16:58:41 -070011 #include <boost/lexical_cast.hpp>
12
13@@ -162,7 +163,7 @@ KeyChain::getDefaultKeyParams()
Ashlesh Gawande6c86e302019-09-17 22:27:05 -050014 //
15
16 KeyChain::KeyChain()
17- : KeyChain(getDefaultPibLocator(), getDefaultTpmLocator(), true)
18+ : KeyChain("pib-dummy", "tpm-dummy", true)
19 {
20 }
21
22diff --git a/ndn-cxx/util/dummy-keychain.cpp b/ndn-cxx/util/dummy-keychain.cpp
23new file mode 100644
Ashlesh Gawandef48424a2020-04-04 16:58:41 -070024index 00000000..2575f11d
Ashlesh Gawande6c86e302019-09-17 22:27:05 -050025--- /dev/null
26+++ b/ndn-cxx/util/dummy-keychain.cpp
Ashlesh Gawandef48424a2020-04-04 16:58:41 -070027@@ -0,0 +1,352 @@
Ashlesh Gawande6c86e302019-09-17 22:27:05 -050028+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
29+/**
30+ * Copyright (c) 2011-2015 Regents of the University of California.
31+ *
32+ * This file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and
33+ * contributors.
34+ *
35+ * ndnSIM is free software: you can redistribute it and/or modify it under the terms
36+ * of the GNU General Public License as published by the Free Software Foundation,
37+ * either version 3 of the License, or (at your option) any later version.
38+ *
39+ * ndnSIM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
40+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
41+ * PURPOSE. See the GNU General Public License for more details.
42+ *
43+ * You should have received a copy of the GNU General Public License along with
44+ * ndnSIM, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
45+ **/
46+
47+#include "dummy-keychain.hpp"
48+
49+#include <ndn-cxx/util/io.hpp>
50+#include <ndn-cxx/security/transform/public-key.hpp>
51+#include <boost/iostreams/device/array.hpp>
52+#include <boost/iostreams/stream.hpp>
53+
54+namespace ndn {
55+namespace security {
56+
57+static const uint8_t DUMMY_CERT[] =
58+ "Bv0CqQclCAVkdW1teQgDS0VZCAgtnChyuKo7YAgCTkEICf0AAAFe3zzGfBQJGAEC"
59+ "GQQANu6AFf0BJjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOJSa1j6"
60+ "JAzobrmtlUdJi38EWQZOigLykf9psImvIu7pa29Q3apBXENcV1E9687FmfY85Ec3"
61+ "/onMtN7WG/wiuKiu/9eOr5WslD3VGDgxhesx80ygP0GNsN8FzsMl0lRKduXx3wG4"
62+ "MCT8CX7uA4n4JbHY+0QaKUEEMRCiXcRAtF+yKfr+GaVeSemg+i/LR+6CSgpOyH0K"
63+ "ogH9nlNhBn1Hxyc8X+B/nEu6P6NNEKkSnhT1jAbWtT1eL3BPGK/HNY19w9k2Ln6/"
64+ "OYlhaHfB4m0oR/ePcUguQBwTgYS+40YQYUPivBsSQv3X2/7+gGLhIzA4YppwOooK"
65+ "RGhbmL8zF2evmJ8CAwEAARZHGwEBHBgHFggFZHVtbXkIA0tFWQgILZwocriqO2D9"
66+ "AP0m/QD+DzIwMTcxMDAyVDIyMzczNv0A/w8yMDE4MTAwMlQyMjM3MzUX/QEAMBUV"
67+ "O51BEQwxp646i7IuHkuc1C/LISnOP2+wBFF2Ea1ht9MKjKkyJdmB1/GAOiR3njKd"
68+ "UgRjBlownL11EwYDxkPY39RR05TmhF6PkpP81Ro/Vzv7rtSi/dxFIZXCiyuKPRUx"
69+ "E0pZelPWVs3zMfqQ+8rWG89Kqs1vM0dglLBzlX9Lbim71TyLmaJaMmmBKv8+eQ22"
70+ "CN71sRZOovl1kKcTHpOm61nD3C1n9GRflFtaMAXE/XU4zMJVzBv6XwQl6PCIc9H2"
71+ "vjLa28ruVjhMGxqCGhziTC2eR56SUixrnEcbOKT0R+8+0AFnZIjdYglOZPcVwTVB"
72+ "G6OxECJOuSoREcd1Ww==;";
73+
74+static const uint8_t DUMMY_SIGNATURE[] =
75+ {0x17, 0xfd, 0x01, 0x00, 0x93, 0x15, 0x09, 0x49, 0x79, 0x9e, 0xb7, 0x9c, 0xd3, 0xc1, 0xbf, 0x61,
76+ 0x89, 0xd5, 0xd9, 0xca, 0xf2, 0xb0, 0x14, 0xae, 0x72, 0x7c, 0x1f, 0x8f, 0xf5, 0xb1, 0x70, 0xd6,
77+ 0x9b, 0x8f, 0xf8, 0xd7, 0x2d, 0xbc, 0x92, 0x6f, 0x7d, 0x77, 0x96, 0x46, 0xea, 0xd4, 0x7d, 0x90,
78+ 0xbc, 0x7a, 0xeb, 0xe2, 0x03, 0x93, 0xb1, 0xd2, 0x62, 0xec, 0x9d, 0xff, 0x9c, 0x9c, 0x2a, 0x14,
79+ 0x7d, 0x23, 0xca, 0x29, 0x3d, 0x15, 0x1a, 0x40, 0x42, 0x2c, 0x59, 0x33, 0x8a, 0xf7, 0xc0, 0x6b,
80+ 0xc4, 0x9c, 0xf3, 0xc4, 0x99, 0xa4, 0x1a, 0x60, 0xf5, 0x28, 0x7d, 0x4c, 0xef, 0x43, 0x7d, 0xbd,
81+ 0x7d, 0x00, 0x51, 0xee, 0x41, 0xf5, 0x25, 0x80, 0xce, 0xe6, 0x64, 0x4f, 0x75, 0x54, 0xf3, 0xb2,
82+ 0x99, 0x9a, 0x0f, 0x93, 0x9a, 0x28, 0x1d, 0xfe, 0x12, 0x8a, 0xe0, 0xc1, 0x02, 0xeb, 0xa4, 0x35,
83+ 0x52, 0x88, 0xac, 0x44, 0x1a, 0x44, 0x82, 0x97, 0x4f, 0x5f, 0xa8, 0xd8, 0x9f, 0x67, 0x38, 0xa8,
84+ 0x64, 0xb6, 0x62, 0x99, 0xbd, 0x96, 0x3c, 0xf5, 0x86, 0x09, 0x5c, 0x97, 0x6b, 0x8f, 0xae, 0xe0,
85+ 0x60, 0xe7, 0x23, 0x98, 0x6a, 0xee, 0xc1, 0xb0, 0x14, 0xbe, 0x46, 0x2c, 0xfb, 0xa7, 0x27, 0x73,
86+ 0xe4, 0xf3, 0x26, 0x33, 0xba, 0x99, 0xd4, 0x01, 0x38, 0xa8, 0xf2, 0x9e, 0x87, 0xe0, 0x71, 0x0b,
87+ 0x25, 0x44, 0x07, 0x35, 0x88, 0xab, 0x67, 0x27, 0x56, 0x0e, 0xb5, 0xb5, 0xe8, 0x27, 0xb4, 0x49,
88+ 0xdc, 0xb8, 0x48, 0x31, 0xff, 0x99, 0x48, 0xab, 0x11, 0xb4, 0xa0, 0xdf, 0x8a, 0x6d, 0xff, 0x43,
89+ 0x69, 0x32, 0xa7, 0xbc, 0x63, 0x9d, 0x0f, 0xe0, 0x95, 0x34, 0x36, 0x25, 0x4b, 0x3e, 0x36, 0xbd,
90+ 0x81, 0x91, 0x0b, 0x91, 0x9f, 0x3a, 0x04, 0xa2, 0x44, 0x28, 0x19, 0xa1, 0x38, 0x21, 0x4f, 0x25,
91+ 0x59, 0x8a, 0x48, 0xc2};
92+
93+const std::string DummyPib::SCHEME = "pib-dummy";
94+const std::string DummyTpm::SCHEME = "tpm-dummy";
95+
96+NDN_CXX_V2_KEYCHAIN_REGISTER_PIB_BACKEND(DummyPib);
97+NDN_CXX_V2_KEYCHAIN_REGISTER_TPM_BACKEND(DummyTpm);
98+
99+DummyPib::DummyPib(const std::string& locator)
100+{
101+}
102+
103+void
104+DummyPib::setTpmLocator(const std::string& tpmLocator)
105+{
106+ m_tpmLocator = tpmLocator;
107+}
108+
109+std::string
110+DummyPib::getTpmLocator() const
111+{
112+ return m_tpmLocator;
113+}
114+
115+bool
116+DummyPib::hasIdentity(const Name& identityName) const
117+{
118+ return true;
119+}
120+
121+void
122+DummyPib::addIdentity(const Name& identityName)
123+{
124+}
125+
126+void
127+DummyPib::removeIdentity(const Name& identity)
128+{
129+}
130+
131+void
132+DummyPib::clearIdentities()
133+{
134+}
135+
136+std::set<Name>
137+DummyPib::getIdentities() const
138+{
139+ std::set<Name> identities;
140+ identities.insert("/dummy");
141+ return identities;
142+}
143+
144+void
145+DummyPib::setDefaultIdentity(const Name& identityName)
146+{
147+}
148+
149+Name
150+DummyPib::getDefaultIdentity() const
151+{
152+ return "/dummy";
153+}
154+
155+bool
156+DummyPib::hasKey(const Name& keyName) const
157+{
158+ return true;
159+}
160+
161+void
162+DummyPib::addKey(const Name& identity, const Name& keyName,
163+ const uint8_t* key, size_t keyLen)
164+{
165+}
166+
167+void
168+DummyPib::removeKey(const Name& keyName)
169+{
170+}
171+
172+Buffer
173+DummyPib::getKeyBits(const Name& keyName) const
174+{
175+ typedef boost::iostreams::stream<boost::iostreams::array_source> arrayStream;
176+ arrayStream
177+ is(reinterpret_cast<const char*>(DUMMY_CERT), sizeof(DUMMY_CERT));
178+ auto cert = io::load<v2::Certificate>(is, io::BASE64);
179+ return cert->getPublicKey();
180+}
181+
182+std::set<Name>
183+DummyPib::getKeysOfIdentity(const Name& identity) const
184+{
185+ std::set<Name> keys;
186+ keys.insert("/dummy/KEY/-%9C%28r%B8%AA%3B%60");
187+ return keys;
188+}
189+
190+void
191+DummyPib::setDefaultKeyOfIdentity(const Name& identity, const Name& keyName)
192+{
193+}
194+
195+Name
196+DummyPib::getDefaultKeyOfIdentity(const Name& identity) const
197+{
198+ return "/dummy/KEY/-%9C%28r%B8%AA%3B%60";
199+}
200+
201+bool
202+DummyPib::hasCertificate(const Name& certName) const
203+{
204+ return true;
205+}
206+
207+void
208+DummyPib::addCertificate(const v2::Certificate& certificate)
209+{
210+}
211+
212+void
213+DummyPib::removeCertificate(const Name& certName)
214+{
215+}
216+
217+v2::Certificate
218+DummyPib::getCertificate(const Name& certificateName) const
219+{
220+ static shared_ptr<v2::Certificate> cert = nullptr;
221+ if (cert == nullptr) {
222+ typedef boost::iostreams::stream<boost::iostreams::array_source> arrayStream;
223+ arrayStream
224+ is(reinterpret_cast<const char*>(DUMMY_CERT), sizeof(DUMMY_CERT));
225+ cert = io::load<v2::Certificate>(is, io::BASE64);
226+ }
227+
228+ return *cert;
229+}
230+
231+std::set<Name>
232+DummyPib::getCertificatesOfKey(const Name& keyName) const
233+{
234+ std::set<Name> certs;
235+ certs.insert("/dummy/KEY/-%9C%28r%B8%AA%3B%60/self/%FD%00%00%01%5E%DF%3Bv%01");
236+ return certs;
237+}
238+
239+void
240+DummyPib::setDefaultCertificateOfKey(const Name& keyName, const Name& certName)
241+{
242+}
243+
244+v2::Certificate
245+DummyPib::getDefaultCertificateOfKey(const Name& keyName) const
246+{
247+ static shared_ptr<v2::Certificate> cert = nullptr;
248+ if (cert == nullptr) {
249+ typedef boost::iostreams::stream<boost::iostreams::array_source> arrayStream;
250+ arrayStream
251+ is(reinterpret_cast<const char*>(DUMMY_CERT), sizeof(DUMMY_CERT));
252+ cert = io::load<v2::Certificate>(is, io::BASE64);
253+ }
254+
255+ return *cert;
256+}
257+
258+std::string
259+DummyPib::getScheme()
260+{
261+ return DummyPib::SCHEME;
262+}
263+
264+//////////////////////////////////////////////////////////////////////////////////////////
265+//////////////////////////////////////////////////////////////////////////////////////////
266+//////////////////////////////////////////////////////////////////////////////////////////
267+//////////////////////////////////////////////////////////////////////////////////////////
268+
269+namespace tpm {
270+
271+DummyKeyHandle::DummyKeyHandle(shared_ptr<transform::PrivateKey> key)
272+{
273+}
274+
275+ConstBufferPtr
276+DummyKeyHandle::doSign(DigestAlgorithm digestAlgorithm, const uint8_t* buf, size_t size) const
277+{
278+ return make_shared<Buffer>(DUMMY_SIGNATURE, sizeof(DUMMY_SIGNATURE));
279+}
280+
281+bool
282+DummyKeyHandle::doVerify(DigestAlgorithm digestAlgorithm, const uint8_t* buf, size_t bufLen,
283+ const uint8_t* sig, size_t sigLen) const
284+{
285+ return true;
286+}
287+
288+ConstBufferPtr
289+DummyKeyHandle::doDecrypt(const uint8_t* cipherText, size_t cipherTextLen) const
290+{
291+ throw Error("Not supported");
292+}
293+
294+ConstBufferPtr
295+DummyKeyHandle::doDerivePublicKey() const
296+{
297+ throw Error("Not supported");
298+}
299+
300+} // namespace tpm
301+
302+//////////////////////////////////////////////////////////////////////////////////////////
303+//////////////////////////////////////////////////////////////////////////////////////////
304+//////////////////////////////////////////////////////////////////////////////////////////
305+//////////////////////////////////////////////////////////////////////////////////////////
306+
307+DummyTpm::DummyTpm(const std::string& locator)
308+{
309+}
310+
311+bool
312+DummyTpm::isTerminalMode() const
313+{
314+ return false;
315+}
316+
317+void
318+DummyTpm::setTerminalMode(bool isTerminal) const
319+{
320+}
321+
322+bool
323+DummyTpm::isTpmLocked() const
324+{
325+ return false;
326+}
327+
328+bool
329+DummyTpm::doHasKey(const Name& keyName) const
330+{
331+ return false;
332+}
333+
334+unique_ptr<tpm::KeyHandle>
335+DummyTpm::doGetKeyHandle(const Name& keyName) const
336+{
337+ unique_ptr<tpm::KeyHandle> m_dummyKeyHandle = make_unique<tpm::DummyKeyHandle>(nullptr);
338+ return m_dummyKeyHandle;
339+}
340+
341+unique_ptr<tpm::KeyHandle>
342+DummyTpm::doCreateKey(const Name& identity, const KeyParams& params)
343+{
344+ unique_ptr<tpm::KeyHandle> m_dummyKeyHandle = make_unique<tpm::DummyKeyHandle>(nullptr);
345+ return m_dummyKeyHandle;
346+}
347+
348+void
349+DummyTpm::doDeleteKey(const Name& keyName)
350+{
351+ throw Error("Not supported");
352+}
353+
354+ConstBufferPtr
355+DummyTpm::doExportKey(const Name& keyName, const char* pw, size_t pwLen)
356+{
357+ throw Error("Not supported");
358+}
359+
360+void
361+DummyTpm::doImportKey(const Name& keyName, const uint8_t* pkcs8, size_t pkcs8Len, const char* pw, size_t pwLen)
362+{
363+ throw Error("Not supported");
364+}
365+
Ashlesh Gawandef48424a2020-04-04 16:58:41 -0700366+void
367+DummyTpm::doImportKey(const Name& keyName, shared_ptr<transform::PrivateKey> key)
368+{
369+ throw Error("Not supported");
370+}
371+
Ashlesh Gawande6c86e302019-09-17 22:27:05 -0500372+std::string
373+DummyTpm::getScheme()
374+{
375+ return DummyTpm::SCHEME;
376+}
377+
378+} // namespace security
379+} // namespace ndn
380diff --git a/ndn-cxx/util/dummy-keychain.hpp b/ndn-cxx/util/dummy-keychain.hpp
381new file mode 100644
Ashlesh Gawandef48424a2020-04-04 16:58:41 -0700382index 00000000..374fdef5
Ashlesh Gawande6c86e302019-09-17 22:27:05 -0500383--- /dev/null
384+++ b/ndn-cxx/util/dummy-keychain.hpp
Ashlesh Gawandef48424a2020-04-04 16:58:41 -0700385@@ -0,0 +1,226 @@
Ashlesh Gawande6c86e302019-09-17 22:27:05 -0500386+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
387+/**
388+ * Copyright (c) 2011-2015 Regents of the University of California.
389+ *
390+ * This file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and
391+ * contributors.
392+ *
393+ * ndnSIM is free software: you can redistribute it and/or modify it under the terms
394+ * of the GNU General Public License as published by the Free Software Foundation,
395+ * either version 3 of the License, or (at your option) any later version.
396+ *
397+ * ndnSIM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
398+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
399+ * PURPOSE. See the GNU General Public License for more details.
400+ *
401+ * You should have received a copy of the GNU General Public License along with
402+ * ndnSIM, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
403+ **/
404+
405+#ifndef NDNSIM_UTILS_DUMMY_KEYCHAIN_HPP
406+#define NDNSIM_UTILS_DUMMY_KEYCHAIN_HPP
407+
408+#include <ndn-cxx/security/key-chain.hpp>
409+#include <ndn-cxx/security/security-common.hpp>
410+#include <ndn-cxx/security/pib/pib-impl.hpp>
411+#include <ndn-cxx/security/tpm/back-end.hpp>
412+#include <ndn-cxx/security/transform/private-key.hpp>
413+
414+namespace ndn {
415+namespace security {
416+
417+using pib::PibImpl;
418+using tpm::BackEnd;
419+using tpm::KeyHandle;
420+
421+class DummyPib : public PibImpl
422+{
423+public:
424+ class Error : public PibImpl::Error
425+ {
426+ public:
427+ explicit
428+ Error(const std::string& what)
429+ : PibImpl::Error(what)
430+ {
431+ }
432+ };
433+
434+public:
435+ explicit DummyPib(const std::string& locator);
436+
437+ // TPM management
438+ void
439+ setTpmLocator(const std::string& tpmLocator) override;
440+
441+ std::string
442+ getTpmLocator() const override;
443+
444+ // Identity manangement
445+ bool
446+ hasIdentity(const Name& identityName) const override;
447+
448+ void
449+ addIdentity(const Name& identityName) override;
450+
451+ void
452+ removeIdentity(const Name& identity) override;
453+
454+ void
455+ clearIdentities() override;
456+
457+ std::set<Name>
458+ getIdentities() const override;
459+
460+ void
461+ setDefaultIdentity(const Name& identityName) override;
462+
463+ Name
464+ getDefaultIdentity() const override;
465+
466+ // Key management
467+ bool
468+ hasKey(const Name& keyName) const override;
469+
470+ void
471+ addKey(const Name& identity, const Name& keyName, const uint8_t* key,
472+ size_t keyLen) override;
473+
474+ void
475+ removeKey(const Name& keyName) override;
476+
477+ Buffer
478+ getKeyBits(const Name& keyName) const override;
479+
480+ std::set<Name>
481+ getKeysOfIdentity(const Name& identity) const override;
482+
483+ void
484+ setDefaultKeyOfIdentity(const Name& identity, const Name& keyName) override;
485+
486+ Name
487+ getDefaultKeyOfIdentity(const Name& identity) const override;
488+
489+ // certificate management
490+ bool
491+ hasCertificate(const Name& certName) const override;
492+
493+ void
494+ addCertificate(const v2::Certificate& certificate) override;
495+
496+ void
497+ removeCertificate(const Name& certName) override;
498+
499+ v2::Certificate
500+ getCertificate(const Name& certificateName) const override;
501+
502+ std::set<Name>
503+ getCertificatesOfKey(const Name& keyName) const override;
504+
505+ void
506+ setDefaultCertificateOfKey(const Name& keyName, const Name& certName) override;
507+
508+ v2::Certificate
509+ getDefaultCertificateOfKey(const Name& keyName) const override;
510+
511+ static std::string
512+ getScheme();
513+
514+ static const std::string SCHEME;
515+
516+private:
517+ std::string m_tpmLocator;
518+};
519+
520+//////////////////////////////////////////////////////////////////////////////////////////
521+//////////////////////////////////////////////////////////////////////////////////////////
522+
523+namespace tpm {
524+
525+class DummyKeyHandle : public KeyHandle
526+{
527+public:
528+ explicit
529+ DummyKeyHandle(shared_ptr<transform::PrivateKey> key);
530+
531+private:
532+ ConstBufferPtr
533+ doSign(DigestAlgorithm digestAlgorithm, const uint8_t* buf, size_t size) const final;
534+
535+ bool
536+ doVerify(DigestAlgorithm digestAlgorithm, const uint8_t* buf, size_t bufLen,
537+ const uint8_t* sig, size_t sigLen) const final;
538+
539+ ConstBufferPtr
540+ doDecrypt(const uint8_t* cipherText, size_t cipherTextLen) const final;
541+
542+ ConstBufferPtr
543+ doDerivePublicKey() const final;
544+};
545+
546+} // namespace tpm
547+
548+//////////////////////////////////////////////////////////////////////////////////////////
549+//////////////////////////////////////////////////////////////////////////////////////////
550+
551+class DummyTpm : public BackEnd
552+{
553+public:
554+ class Error : public BackEnd::Error
555+ {
556+ public:
557+ explicit
558+ Error(const std::string& what)
559+ : BackEnd::Error(what)
560+ {
561+ }
562+ };
563+
564+public:
565+ explicit DummyTpm(const std::string& locator);
566+
567+ bool
568+ isTerminalMode() const override;
569+
570+ void
571+ setTerminalMode(bool isTerminal) const override;
572+
573+ bool
574+ isTpmLocked() const override;
575+
576+ ConstBufferPtr
577+ sign(const uint8_t* buf, size_t size, const Name& keyName, DigestAlgorithm digestAlgorithm) const;
578+
579+ static std::string
580+ getScheme();
581+
582+private:
583+ bool
584+ doHasKey(const Name& keyName) const final;
585+
586+ unique_ptr<tpm::KeyHandle>
587+ doGetKeyHandle(const Name& keyName) const final;
588+
589+ unique_ptr<tpm::KeyHandle>
590+ doCreateKey(const Name& identity, const KeyParams& params) final;
591+
592+ void
593+ doDeleteKey(const Name& keyName) final;
594+
595+ ConstBufferPtr
596+ doExportKey(const Name& keyName, const char* pw, size_t pwLen) final;
597+
598+ void
599+ doImportKey(const Name& keyName, const uint8_t* pkcs8, size_t pkcs8Len, const char* pw, size_t pwLen) final;
600+
Ashlesh Gawandef48424a2020-04-04 16:58:41 -0700601+ void
602+ doImportKey(const Name& keyName, shared_ptr<transform::PrivateKey> key);
603+
Ashlesh Gawande6c86e302019-09-17 22:27:05 -0500604+public:
605+ static const std::string SCHEME;
606+};
607+
608+} // namespace security
609+} // namespace ndn
610+
611+#endif // NDNSIM_UTILS_DUMMY_KEYCHAIN_HPP