Alexander Afanasyev | 60a7b62 | 2014-12-20 17:04:07 -0800 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
| 3 | * Copyright (c) 2011-2015 Regents of the University of California. |
Alexander Afanasyev | 34e13f3 | 2014-12-14 15:13:28 -0800 | [diff] [blame] | 4 | * |
Alexander Afanasyev | 60a7b62 | 2014-12-20 17:04:07 -0800 | [diff] [blame] | 5 | * This file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and |
| 6 | * contributors. |
Alexander Afanasyev | 34e13f3 | 2014-12-14 15:13:28 -0800 | [diff] [blame] | 7 | * |
Alexander Afanasyev | 60a7b62 | 2014-12-20 17:04:07 -0800 | [diff] [blame] | 8 | * ndnSIM is free software: you can redistribute it and/or modify it under the terms |
| 9 | * of the GNU General Public License as published by the Free Software Foundation, |
| 10 | * either version 3 of the License, or (at your option) any later version. |
Alexander Afanasyev | 34e13f3 | 2014-12-14 15:13:28 -0800 | [diff] [blame] | 11 | * |
Alexander Afanasyev | 60a7b62 | 2014-12-20 17:04:07 -0800 | [diff] [blame] | 12 | * ndnSIM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 13 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 14 | * PURPOSE. See the GNU General Public License for more details. |
Alexander Afanasyev | 34e13f3 | 2014-12-14 15:13:28 -0800 | [diff] [blame] | 15 | * |
Alexander Afanasyev | 60a7b62 | 2014-12-20 17:04:07 -0800 | [diff] [blame] | 16 | * You should have received a copy of the GNU General Public License along with |
| 17 | * ndnSIM, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 18 | **/ |
Alexander Afanasyev | 34e13f3 | 2014-12-14 15:13:28 -0800 | [diff] [blame] | 19 | |
| 20 | #include "dummy-keychain.hpp" |
| 21 | |
| 22 | #include <ndn-cxx/util/io.hpp> |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 23 | #include <ndn-cxx/security/transform/public-key.hpp> |
Alexander Afanasyev | 34e13f3 | 2014-12-14 15:13:28 -0800 | [diff] [blame] | 24 | #include <boost/iostreams/device/array.hpp> |
Spyridon Mastorakis | b0b2241 | 2016-12-07 14:33:46 -0800 | [diff] [blame] | 25 | #include <boost/iostreams/stream.hpp> |
Alexander Afanasyev | 34e13f3 | 2014-12-14 15:13:28 -0800 | [diff] [blame] | 26 | |
| 27 | namespace ndn { |
| 28 | namespace security { |
| 29 | |
| 30 | static const uint8_t DUMMY_CERT[] = |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 31 | "Bv0CqQclCAVkdW1teQgDS0VZCAgtnChyuKo7YAgCTkEICf0AAAFe3zzGfBQJGAEC" |
| 32 | "GQQANu6AFf0BJjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOJSa1j6" |
| 33 | "JAzobrmtlUdJi38EWQZOigLykf9psImvIu7pa29Q3apBXENcV1E9687FmfY85Ec3" |
| 34 | "/onMtN7WG/wiuKiu/9eOr5WslD3VGDgxhesx80ygP0GNsN8FzsMl0lRKduXx3wG4" |
| 35 | "MCT8CX7uA4n4JbHY+0QaKUEEMRCiXcRAtF+yKfr+GaVeSemg+i/LR+6CSgpOyH0K" |
| 36 | "ogH9nlNhBn1Hxyc8X+B/nEu6P6NNEKkSnhT1jAbWtT1eL3BPGK/HNY19w9k2Ln6/" |
| 37 | "OYlhaHfB4m0oR/ePcUguQBwTgYS+40YQYUPivBsSQv3X2/7+gGLhIzA4YppwOooK" |
| 38 | "RGhbmL8zF2evmJ8CAwEAARZHGwEBHBgHFggFZHVtbXkIA0tFWQgILZwocriqO2D9" |
| 39 | "AP0m/QD+DzIwMTcxMDAyVDIyMzczNv0A/w8yMDE4MTAwMlQyMjM3MzUX/QEAMBUV" |
| 40 | "O51BEQwxp646i7IuHkuc1C/LISnOP2+wBFF2Ea1ht9MKjKkyJdmB1/GAOiR3njKd" |
| 41 | "UgRjBlownL11EwYDxkPY39RR05TmhF6PkpP81Ro/Vzv7rtSi/dxFIZXCiyuKPRUx" |
| 42 | "E0pZelPWVs3zMfqQ+8rWG89Kqs1vM0dglLBzlX9Lbim71TyLmaJaMmmBKv8+eQ22" |
| 43 | "CN71sRZOovl1kKcTHpOm61nD3C1n9GRflFtaMAXE/XU4zMJVzBv6XwQl6PCIc9H2" |
| 44 | "vjLa28ruVjhMGxqCGhziTC2eR56SUixrnEcbOKT0R+8+0AFnZIjdYglOZPcVwTVB" |
| 45 | "G6OxECJOuSoREcd1Ww==;"; |
Alexander Afanasyev | 34e13f3 | 2014-12-14 15:13:28 -0800 | [diff] [blame] | 46 | |
| 47 | static const uint8_t DUMMY_SIGNATURE[] = |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 48 | {0x17, 0xfd, 0x01, 0x00, 0x93, 0x15, 0x09, 0x49, 0x79, 0x9e, 0xb7, 0x9c, 0xd3, 0xc1, 0xbf, 0x61, |
| 49 | 0x89, 0xd5, 0xd9, 0xca, 0xf2, 0xb0, 0x14, 0xae, 0x72, 0x7c, 0x1f, 0x8f, 0xf5, 0xb1, 0x70, 0xd6, |
| 50 | 0x9b, 0x8f, 0xf8, 0xd7, 0x2d, 0xbc, 0x92, 0x6f, 0x7d, 0x77, 0x96, 0x46, 0xea, 0xd4, 0x7d, 0x90, |
| 51 | 0xbc, 0x7a, 0xeb, 0xe2, 0x03, 0x93, 0xb1, 0xd2, 0x62, 0xec, 0x9d, 0xff, 0x9c, 0x9c, 0x2a, 0x14, |
| 52 | 0x7d, 0x23, 0xca, 0x29, 0x3d, 0x15, 0x1a, 0x40, 0x42, 0x2c, 0x59, 0x33, 0x8a, 0xf7, 0xc0, 0x6b, |
| 53 | 0xc4, 0x9c, 0xf3, 0xc4, 0x99, 0xa4, 0x1a, 0x60, 0xf5, 0x28, 0x7d, 0x4c, 0xef, 0x43, 0x7d, 0xbd, |
| 54 | 0x7d, 0x00, 0x51, 0xee, 0x41, 0xf5, 0x25, 0x80, 0xce, 0xe6, 0x64, 0x4f, 0x75, 0x54, 0xf3, 0xb2, |
| 55 | 0x99, 0x9a, 0x0f, 0x93, 0x9a, 0x28, 0x1d, 0xfe, 0x12, 0x8a, 0xe0, 0xc1, 0x02, 0xeb, 0xa4, 0x35, |
| 56 | 0x52, 0x88, 0xac, 0x44, 0x1a, 0x44, 0x82, 0x97, 0x4f, 0x5f, 0xa8, 0xd8, 0x9f, 0x67, 0x38, 0xa8, |
| 57 | 0x64, 0xb6, 0x62, 0x99, 0xbd, 0x96, 0x3c, 0xf5, 0x86, 0x09, 0x5c, 0x97, 0x6b, 0x8f, 0xae, 0xe0, |
| 58 | 0x60, 0xe7, 0x23, 0x98, 0x6a, 0xee, 0xc1, 0xb0, 0x14, 0xbe, 0x46, 0x2c, 0xfb, 0xa7, 0x27, 0x73, |
| 59 | 0xe4, 0xf3, 0x26, 0x33, 0xba, 0x99, 0xd4, 0x01, 0x38, 0xa8, 0xf2, 0x9e, 0x87, 0xe0, 0x71, 0x0b, |
| 60 | 0x25, 0x44, 0x07, 0x35, 0x88, 0xab, 0x67, 0x27, 0x56, 0x0e, 0xb5, 0xb5, 0xe8, 0x27, 0xb4, 0x49, |
| 61 | 0xdc, 0xb8, 0x48, 0x31, 0xff, 0x99, 0x48, 0xab, 0x11, 0xb4, 0xa0, 0xdf, 0x8a, 0x6d, 0xff, 0x43, |
| 62 | 0x69, 0x32, 0xa7, 0xbc, 0x63, 0x9d, 0x0f, 0xe0, 0x95, 0x34, 0x36, 0x25, 0x4b, 0x3e, 0x36, 0xbd, |
| 63 | 0x81, 0x91, 0x0b, 0x91, 0x9f, 0x3a, 0x04, 0xa2, 0x44, 0x28, 0x19, 0xa1, 0x38, 0x21, 0x4f, 0x25, |
| 64 | 0x59, 0x8a, 0x48, 0xc2}; |
Alexander Afanasyev | 34e13f3 | 2014-12-14 15:13:28 -0800 | [diff] [blame] | 65 | |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 66 | const std::string DummyPib::SCHEME = "pib-dummy"; |
Alexander Afanasyev | df26b5a | 2015-01-15 23:30:56 -0800 | [diff] [blame] | 67 | const std::string DummyTpm::SCHEME = "tpm-dummy"; |
| 68 | |
Alexander Afanasyev | f007a99 | 2022-05-05 15:57:08 -0400 | [diff] [blame] | 69 | NDN_CXX_KEYCHAIN_REGISTER_PIB_BACKEND(DummyPib); |
| 70 | NDN_CXX_KEYCHAIN_REGISTER_TPM_BACKEND(DummyTpm); |
Alexander Afanasyev | df26b5a | 2015-01-15 23:30:56 -0800 | [diff] [blame] | 71 | |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 72 | DummyPib::DummyPib(const std::string& locator) |
Alexander Afanasyev | 34e13f3 | 2014-12-14 15:13:28 -0800 | [diff] [blame] | 73 | { |
| 74 | } |
| 75 | |
| 76 | void |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 77 | DummyPib::setTpmLocator(const std::string& tpmLocator) |
Alexander Afanasyev | df26b5a | 2015-01-15 23:30:56 -0800 | [diff] [blame] | 78 | { |
| 79 | m_tpmLocator = tpmLocator; |
| 80 | } |
| 81 | |
| 82 | std::string |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 83 | DummyPib::getTpmLocator() const |
Alexander Afanasyev | df26b5a | 2015-01-15 23:30:56 -0800 | [diff] [blame] | 84 | { |
| 85 | return m_tpmLocator; |
| 86 | } |
| 87 | |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 88 | bool |
| 89 | DummyPib::hasIdentity(const Name& identityName) const |
Alexander Afanasyev | df26b5a | 2015-01-15 23:30:56 -0800 | [diff] [blame] | 90 | { |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 91 | return true; |
Alexander Afanasyev | df26b5a | 2015-01-15 23:30:56 -0800 | [diff] [blame] | 92 | } |
| 93 | |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 94 | void |
| 95 | DummyPib::addIdentity(const Name& identityName) |
| 96 | { |
| 97 | } |
| 98 | |
| 99 | void |
| 100 | DummyPib::removeIdentity(const Name& identity) |
| 101 | { |
| 102 | } |
| 103 | |
| 104 | void |
| 105 | DummyPib::clearIdentities() |
| 106 | { |
| 107 | } |
| 108 | |
| 109 | std::set<Name> |
| 110 | DummyPib::getIdentities() const |
| 111 | { |
| 112 | std::set<Name> identities; |
| 113 | identities.insert("/dummy"); |
| 114 | return identities; |
| 115 | } |
| 116 | |
| 117 | void |
| 118 | DummyPib::setDefaultIdentity(const Name& identityName) |
| 119 | { |
| 120 | } |
| 121 | |
| 122 | Name |
| 123 | DummyPib::getDefaultIdentity() const |
| 124 | { |
| 125 | return "/dummy"; |
| 126 | } |
| 127 | |
| 128 | bool |
| 129 | DummyPib::hasKey(const Name& keyName) const |
| 130 | { |
| 131 | return true; |
| 132 | } |
| 133 | |
| 134 | void |
Alexander Afanasyev | f007a99 | 2022-05-05 15:57:08 -0400 | [diff] [blame] | 135 | DummyPib::addKey(const Name& identity, const Name& keyName, span<const uint8_t> key) |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 136 | { |
| 137 | } |
| 138 | |
| 139 | void |
| 140 | DummyPib::removeKey(const Name& keyName) |
| 141 | { |
| 142 | } |
| 143 | |
| 144 | Buffer |
| 145 | DummyPib::getKeyBits(const Name& keyName) const |
| 146 | { |
| 147 | typedef boost::iostreams::stream<boost::iostreams::array_source> arrayStream; |
| 148 | arrayStream |
| 149 | is(reinterpret_cast<const char*>(DUMMY_CERT), sizeof(DUMMY_CERT)); |
Alexander Afanasyev | f007a99 | 2022-05-05 15:57:08 -0400 | [diff] [blame] | 150 | auto cert = io::load<Certificate>(is, io::BASE64); |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 151 | return cert->getPublicKey(); |
| 152 | } |
| 153 | |
| 154 | std::set<Name> |
| 155 | DummyPib::getKeysOfIdentity(const Name& identity) const |
| 156 | { |
| 157 | std::set<Name> keys; |
| 158 | keys.insert("/dummy/KEY/-%9C%28r%B8%AA%3B%60"); |
| 159 | return keys; |
| 160 | } |
| 161 | |
| 162 | void |
| 163 | DummyPib::setDefaultKeyOfIdentity(const Name& identity, const Name& keyName) |
| 164 | { |
| 165 | } |
| 166 | |
| 167 | Name |
| 168 | DummyPib::getDefaultKeyOfIdentity(const Name& identity) const |
| 169 | { |
| 170 | return "/dummy/KEY/-%9C%28r%B8%AA%3B%60"; |
| 171 | } |
| 172 | |
| 173 | bool |
| 174 | DummyPib::hasCertificate(const Name& certName) const |
| 175 | { |
| 176 | return true; |
| 177 | } |
| 178 | |
| 179 | void |
Alexander Afanasyev | f007a99 | 2022-05-05 15:57:08 -0400 | [diff] [blame] | 180 | DummyPib::addCertificate(const Certificate& certificate) |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 181 | { |
| 182 | } |
| 183 | |
| 184 | void |
| 185 | DummyPib::removeCertificate(const Name& certName) |
| 186 | { |
| 187 | } |
| 188 | |
Alexander Afanasyev | f007a99 | 2022-05-05 15:57:08 -0400 | [diff] [blame] | 189 | Certificate |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 190 | DummyPib::getCertificate(const Name& certificateName) const |
| 191 | { |
Alexander Afanasyev | f007a99 | 2022-05-05 15:57:08 -0400 | [diff] [blame] | 192 | static shared_ptr<Certificate> cert = nullptr; |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 193 | if (cert == nullptr) { |
| 194 | typedef boost::iostreams::stream<boost::iostreams::array_source> arrayStream; |
| 195 | arrayStream |
| 196 | is(reinterpret_cast<const char*>(DUMMY_CERT), sizeof(DUMMY_CERT)); |
Alexander Afanasyev | f007a99 | 2022-05-05 15:57:08 -0400 | [diff] [blame] | 197 | cert = io::load<Certificate>(is, io::BASE64); |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 198 | } |
| 199 | |
| 200 | return *cert; |
| 201 | } |
| 202 | |
| 203 | std::set<Name> |
| 204 | DummyPib::getCertificatesOfKey(const Name& keyName) const |
| 205 | { |
| 206 | std::set<Name> certs; |
| 207 | certs.insert("/dummy/KEY/-%9C%28r%B8%AA%3B%60/self/%FD%00%00%01%5E%DF%3Bv%01"); |
| 208 | return certs; |
| 209 | } |
| 210 | |
| 211 | void |
| 212 | DummyPib::setDefaultCertificateOfKey(const Name& keyName, const Name& certName) |
| 213 | { |
| 214 | } |
| 215 | |
Alexander Afanasyev | f007a99 | 2022-05-05 15:57:08 -0400 | [diff] [blame] | 216 | Certificate |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 217 | DummyPib::getDefaultCertificateOfKey(const Name& keyName) const |
| 218 | { |
Alexander Afanasyev | f007a99 | 2022-05-05 15:57:08 -0400 | [diff] [blame] | 219 | static shared_ptr<Certificate> cert = nullptr; |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 220 | if (cert == nullptr) { |
| 221 | typedef boost::iostreams::stream<boost::iostreams::array_source> arrayStream; |
| 222 | arrayStream |
| 223 | is(reinterpret_cast<const char*>(DUMMY_CERT), sizeof(DUMMY_CERT)); |
Alexander Afanasyev | f007a99 | 2022-05-05 15:57:08 -0400 | [diff] [blame] | 224 | cert = io::load<Certificate>(is, io::BASE64); |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 225 | } |
| 226 | |
| 227 | return *cert; |
| 228 | } |
| 229 | |
| 230 | std::string |
| 231 | DummyPib::getScheme() |
| 232 | { |
| 233 | return DummyPib::SCHEME; |
| 234 | } |
| 235 | |
| 236 | ////////////////////////////////////////////////////////////////////////////////////////// |
| 237 | ////////////////////////////////////////////////////////////////////////////////////////// |
| 238 | ////////////////////////////////////////////////////////////////////////////////////////// |
| 239 | ////////////////////////////////////////////////////////////////////////////////////////// |
| 240 | |
| 241 | namespace tpm { |
| 242 | |
| 243 | DummyKeyHandle::DummyKeyHandle(shared_ptr<transform::PrivateKey> key) |
| 244 | { |
| 245 | } |
| 246 | |
| 247 | ConstBufferPtr |
Alexander Afanasyev | f007a99 | 2022-05-05 15:57:08 -0400 | [diff] [blame] | 248 | DummyKeyHandle::doSign(DigestAlgorithm digestAlgorithm, const InputBuffers& bufs) const |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 249 | { |
| 250 | return make_shared<Buffer>(DUMMY_SIGNATURE, sizeof(DUMMY_SIGNATURE)); |
| 251 | } |
| 252 | |
Alexander Afanasyev | 59090db | 2020-02-21 16:37:43 -0500 | [diff] [blame] | 253 | bool |
Alexander Afanasyev | f007a99 | 2022-05-05 15:57:08 -0400 | [diff] [blame] | 254 | DummyKeyHandle::doVerify(DigestAlgorithm digestAlgorithm, const InputBuffers& bufs, span<const uint8_t> sig) const |
Alexander Afanasyev | 59090db | 2020-02-21 16:37:43 -0500 | [diff] [blame] | 255 | { |
| 256 | throw Error("Not supported"); |
| 257 | } |
| 258 | |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 259 | ConstBufferPtr |
Alexander Afanasyev | f007a99 | 2022-05-05 15:57:08 -0400 | [diff] [blame] | 260 | DummyKeyHandle::doDecrypt(span<const uint8_t> cipherText) const |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 261 | { |
| 262 | throw Error("Not supported"); |
| 263 | } |
| 264 | |
| 265 | ConstBufferPtr |
| 266 | DummyKeyHandle::doDerivePublicKey() const |
| 267 | { |
| 268 | throw Error("Not supported"); |
| 269 | } |
| 270 | |
| 271 | } // namespace tpm |
| 272 | |
Alexander Afanasyev | 34e13f3 | 2014-12-14 15:13:28 -0800 | [diff] [blame] | 273 | ////////////////////////////////////////////////////////////////////////////////////////// |
| 274 | ////////////////////////////////////////////////////////////////////////////////////////// |
| 275 | ////////////////////////////////////////////////////////////////////////////////////////// |
| 276 | ////////////////////////////////////////////////////////////////////////////////////////// |
| 277 | |
Alexander Afanasyev | df26b5a | 2015-01-15 23:30:56 -0800 | [diff] [blame] | 278 | DummyTpm::DummyTpm(const std::string& locator) |
Alexander Afanasyev | 34e13f3 | 2014-12-14 15:13:28 -0800 | [diff] [blame] | 279 | { |
| 280 | } |
| 281 | |
| 282 | bool |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 283 | DummyTpm::isTerminalMode() const |
| 284 | { |
| 285 | return false; |
| 286 | } |
| 287 | |
| 288 | void |
| 289 | DummyTpm::setTerminalMode(bool isTerminal) const |
| 290 | { |
| 291 | } |
| 292 | |
| 293 | bool |
| 294 | DummyTpm::isTpmLocked() const |
Alexander Afanasyev | 34e13f3 | 2014-12-14 15:13:28 -0800 | [diff] [blame] | 295 | { |
| 296 | return false; |
| 297 | } |
| 298 | |
| 299 | bool |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 300 | DummyTpm::doHasKey(const Name& keyName) const |
Alexander Afanasyev | 34e13f3 | 2014-12-14 15:13:28 -0800 | [diff] [blame] | 301 | { |
| 302 | return false; |
| 303 | } |
| 304 | |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 305 | unique_ptr<tpm::KeyHandle> |
| 306 | DummyTpm::doGetKeyHandle(const Name& keyName) const |
Alexander Afanasyev | 34e13f3 | 2014-12-14 15:13:28 -0800 | [diff] [blame] | 307 | { |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 308 | unique_ptr<tpm::KeyHandle> m_dummyKeyHandle = make_unique<tpm::DummyKeyHandle>(nullptr); |
| 309 | return m_dummyKeyHandle; |
| 310 | } |
| 311 | |
| 312 | unique_ptr<tpm::KeyHandle> |
| 313 | DummyTpm::doCreateKey(const Name& identity, const KeyParams& params) |
| 314 | { |
| 315 | unique_ptr<tpm::KeyHandle> m_dummyKeyHandle = make_unique<tpm::DummyKeyHandle>(nullptr); |
| 316 | return m_dummyKeyHandle; |
Alexander Afanasyev | 34e13f3 | 2014-12-14 15:13:28 -0800 | [diff] [blame] | 317 | } |
| 318 | |
| 319 | void |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 320 | DummyTpm::doDeleteKey(const Name& keyName) |
Alexander Afanasyev | 34e13f3 | 2014-12-14 15:13:28 -0800 | [diff] [blame] | 321 | { |
| 322 | throw Error("Not supported"); |
| 323 | } |
| 324 | |
| 325 | ConstBufferPtr |
Spyridon Mastorakis | 17be058 | 2017-09-27 20:32:39 -0700 | [diff] [blame] | 326 | DummyTpm::doExportKey(const Name& keyName, const char* pw, size_t pwLen) |
Alexander Afanasyev | 34e13f3 | 2014-12-14 15:13:28 -0800 | [diff] [blame] | 327 | { |
| 328 | throw Error("Not supported"); |
| 329 | } |
| 330 | |
| 331 | void |
Alexander Afanasyev | f007a99 | 2022-05-05 15:57:08 -0400 | [diff] [blame] | 332 | DummyTpm::doImportKey(const Name& keyName, span<const uint8_t> pkcs8, const char* pw, size_t pwLen) |
Alexander Afanasyev | 34e13f3 | 2014-12-14 15:13:28 -0800 | [diff] [blame] | 333 | { |
| 334 | throw Error("Not supported"); |
| 335 | } |
| 336 | |
Alexander Afanasyev | 59090db | 2020-02-21 16:37:43 -0500 | [diff] [blame] | 337 | void |
| 338 | DummyTpm::doImportKey(const Name& keyName, shared_ptr<transform::PrivateKey> key) |
| 339 | { |
| 340 | throw Error("Not supported"); |
| 341 | } |
| 342 | |
Alexander Afanasyev | df26b5a | 2015-01-15 23:30:56 -0800 | [diff] [blame] | 343 | std::string |
| 344 | DummyTpm::getScheme() |
| 345 | { |
| 346 | return DummyTpm::SCHEME; |
| 347 | } |
| 348 | |
Alexander Afanasyev | 34e13f3 | 2014-12-14 15:13:28 -0800 | [diff] [blame] | 349 | } // namespace security |
| 350 | } // namespace ndn |