Jeff Thompson | 25b4e61 | 2013-10-10 16:03:24 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
Jeff Thompson | 47c93cf | 2013-08-09 00:38:48 -0700 | [diff] [blame] | 2 | /** |
Jeff Thompson | 7687dc0 | 2013-09-13 11:54:07 -0700 | [diff] [blame] | 3 | * Copyright (C) 2013 Regents of the University of California. |
Jeff Thompson | ba16b8f | 2013-12-16 13:11:47 -0800 | [diff] [blame] | 4 | * @author: Yingdi Yu <yingdi@cs.ucla.edu> |
Jeff Thompson | 7687dc0 | 2013-09-13 11:54:07 -0700 | [diff] [blame] | 5 | * @author: Jeff Thompson <jefft0@remap.ucla.edu> |
Jeff Thompson | 47c93cf | 2013-08-09 00:38:48 -0700 | [diff] [blame] | 6 | * See COPYING for copyright and distribution information. |
| 7 | */ |
| 8 | |
| 9 | #ifndef NDN_KEY_CHAIN_HPP |
Jeff Thompson | 2d27e2f | 2013-08-09 12:55:00 -0700 | [diff] [blame] | 10 | #define NDN_KEY_CHAIN_HPP |
Jeff Thompson | 47c93cf | 2013-08-09 00:38:48 -0700 | [diff] [blame] | 11 | |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 12 | #include "certificate/identity-certificate.hpp" |
| 13 | #include "certificate/public-key.hpp" |
| 14 | #include "identity/identity-storage.hpp" |
| 15 | #include "identity/private-key-storage.hpp" |
| 16 | |
Jeff Thompson | 47c93cf | 2013-08-09 00:38:48 -0700 | [diff] [blame] | 17 | |
| 18 | namespace ndn { |
| 19 | |
Jeff Thompson | 2ce8f49 | 2013-09-17 18:01:25 -0700 | [diff] [blame] | 20 | /** |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 21 | * KeyChain is one of the main classes of the security library. |
Jeff Thompson | ffa36f9 | 2013-09-20 08:42:41 -0700 | [diff] [blame] | 22 | * |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 23 | * The KeyChain class provides a set of interfaces of identity management and private key related operations. |
Jeff Thompson | ffa36f9 | 2013-09-20 08:42:41 -0700 | [diff] [blame] | 24 | */ |
Jeff Thompson | 47c93cf | 2013-08-09 00:38:48 -0700 | [diff] [blame] | 25 | class KeyChain { |
| 26 | public: |
Alexander Afanasyev | 64a3d81 | 2014-01-05 23:35:05 -0800 | [diff] [blame] | 27 | struct Error : public std::runtime_error { Error(const std::string &what) : std::runtime_error(what) {} }; |
Jeff Thompson | 2ce8f49 | 2013-09-17 18:01:25 -0700 | [diff] [blame] | 28 | |
Alexander Afanasyev | bd5ba40 | 2014-01-05 22:41:09 -0800 | [diff] [blame] | 29 | KeyChain(const ptr_lib::shared_ptr<IdentityStorage> &identityStorage = DefaultIdentityStorage, |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 30 | const ptr_lib::shared_ptr<PrivateKeyStorage> &privateKeyStorage = DefaultPrivateKeyStorage); |
| 31 | |
| 32 | inline IdentityStorage& |
| 33 | info(); |
| 34 | |
| 35 | inline const IdentityStorage& |
| 36 | info() const; |
| 37 | |
| 38 | inline PrivateKeyStorage& |
| 39 | tpm(); |
| 40 | |
| 41 | inline const PrivateKeyStorage& |
| 42 | tpm() const; |
| 43 | |
| 44 | |
| 45 | /** |
| 46 | * Create an identity by creating a pair of Key-Signing-Key (KSK) for this identity and a self-signed certificate of the KSK. |
| 47 | * @param identityName The name of the identity. |
| 48 | * @return The key name of the auto-generated KSK of the identity. |
| 49 | */ |
| 50 | Name |
| 51 | createIdentity(const Name& identityName); |
| 52 | |
| 53 | /** |
| 54 | * Get the default identity. |
| 55 | * @return The default identity name. |
| 56 | */ |
| 57 | Name |
| 58 | getDefaultIdentity() |
| 59 | { |
| 60 | return info().getDefaultIdentity(); |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * Generate a pair of RSA keys for the specified identity. |
| 65 | * @param identityName The name of the identity. |
| 66 | * @param isKsk true for generating a Key-Signing-Key (KSK), false for a Data-Signing-Key (KSK). |
| 67 | * @param keySize The size of the key. |
| 68 | * @return The generated key name. |
| 69 | */ |
| 70 | Name |
| 71 | generateRSAKeyPair(const Name& identityName, bool isKsk = false, int keySize = 2048); |
Alexander Afanasyev | 64a3d81 | 2014-01-05 23:35:05 -0800 | [diff] [blame] | 72 | |
| 73 | /** |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 74 | * Set a key as the default key of an identity. |
| 75 | * @param keyName The name of the key. |
| 76 | * @param identityName the name of the identity. If not specified, the identity name is inferred from the keyName. |
Alexander Afanasyev | 64a3d81 | 2014-01-05 23:35:05 -0800 | [diff] [blame] | 77 | */ |
| 78 | void |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 79 | setDefaultKeyForIdentity(const Name& keyName, const Name& identityName = Name()) |
| 80 | { |
| 81 | info().setDefaultKeyNameForIdentity(keyName, identityName); |
| 82 | defaultCertificate_.reset(); |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Get the default key for an identity. |
| 87 | * @param identityName the name of the identity. If omitted, the identity name is inferred from the keyName. |
| 88 | * @return The default key name. |
| 89 | */ |
| 90 | Name |
| 91 | getDefaultKeyNameForIdentity(const Name& identityName = Name()) |
| 92 | { |
| 93 | return info().getDefaultKeyNameForIdentity(identityName); |
| 94 | } |
Alexander Afanasyev | 64a3d81 | 2014-01-05 23:35:05 -0800 | [diff] [blame] | 95 | |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 96 | /** |
| 97 | * Generate a pair of RSA keys for the specified identity and set it as default key for the identity. |
| 98 | * @param identityName The name of the identity. |
| 99 | * @param isKsk true for generating a Key-Signing-Key (KSK), false for a Data-Signing-Key (KSK). |
| 100 | * @param keySize The size of the key. |
| 101 | * @return The generated key name. |
| 102 | */ |
| 103 | Name |
| 104 | generateRSAKeyPairAsDefault(const Name& identityName, bool isKsk = false, int keySize = 2048); |
Jeff Thompson | 79a2d5d | 2013-09-27 14:32:23 -0700 | [diff] [blame] | 105 | |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 106 | /** |
| 107 | * Get the public key with the specified name. |
| 108 | * @param keyName The name of the key. |
| 109 | * @return The public key. |
| 110 | */ |
| 111 | ptr_lib::shared_ptr<PublicKey> |
| 112 | getPublicKey(const Name& keyName) |
Jeff Thompson | 79a2d5d | 2013-09-27 14:32:23 -0700 | [diff] [blame] | 113 | { |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 114 | return info().getKey(keyName); |
Jeff Thompson | 79a2d5d | 2013-09-27 14:32:23 -0700 | [diff] [blame] | 115 | } |
Jeff Thompson | 79a2d5d | 2013-09-27 14:32:23 -0700 | [diff] [blame] | 116 | |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 117 | /** |
| 118 | * Create an identity certificate for a public key managed by this IdentityManager. |
| 119 | * @param certificatePrefix The name of public key to be signed. |
| 120 | * @param signerCertificateName The name of signing certificate. |
| 121 | * @param notBefore The notBefore value in the validity field of the generated certificate. |
| 122 | * @param notAfter The notAfter vallue in validity field of the generated certificate. |
| 123 | * @return The name of generated identity certificate. |
| 124 | */ |
| 125 | ptr_lib::shared_ptr<IdentityCertificate> |
| 126 | createIdentityCertificate |
| 127 | (const Name& certificatePrefix, |
| 128 | const Name& signerCertificateName, |
| 129 | const MillisecondsSince1970& notBefore, |
| 130 | const MillisecondsSince1970& notAfter); |
Jeff Thompson | 79a2d5d | 2013-09-27 14:32:23 -0700 | [diff] [blame] | 131 | |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 132 | /** |
| 133 | * Create an identity certificate for a public key supplied by the caller. |
| 134 | * @param certificatePrefix The name of public key to be signed. |
| 135 | * @param publickey The public key to be signed. |
| 136 | * @param signerCertificateName The name of signing certificate. |
| 137 | * @param notBefore The notBefore value in the validity field of the generated certificate. |
| 138 | * @param notAfter The notAfter vallue in validity field of the generated certificate. |
| 139 | * @return The generated identity certificate. |
| 140 | */ |
| 141 | ptr_lib::shared_ptr<IdentityCertificate> |
| 142 | createIdentityCertificate |
| 143 | (const Name& certificatePrefix, |
| 144 | const PublicKey& publickey, |
| 145 | const Name& signerCertificateName, |
| 146 | const MillisecondsSince1970& notBefore, |
| 147 | const MillisecondsSince1970& notAfter); |
| 148 | |
| 149 | /** |
| 150 | * Add a certificate into the public key identity storage. |
| 151 | * @param certificate The certificate to to added. This makes a copy of the certificate. |
| 152 | */ |
| 153 | void |
| 154 | addCertificate(const IdentityCertificate& certificate) |
Alexander Afanasyev | 64a3d81 | 2014-01-05 23:35:05 -0800 | [diff] [blame] | 155 | { |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 156 | info().addCertificate(certificate); |
Alexander Afanasyev | 64a3d81 | 2014-01-05 23:35:05 -0800 | [diff] [blame] | 157 | } |
| 158 | |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 159 | /** |
| 160 | * Set the certificate as the default for its corresponding key. |
| 161 | * @param certificateName The certificate. |
| 162 | */ |
| 163 | void |
| 164 | setDefaultCertificateForKey(const IdentityCertificate& certificate); |
Alexander Afanasyev | bf1a67a | 2014-01-05 23:36:13 -0800 | [diff] [blame] | 165 | |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 166 | /** |
| 167 | * Add a certificate into the public key identity storage and set the certificate as the default for its corresponding identity. |
| 168 | * @param certificate The certificate to be added. This makes a copy of the certificate. |
| 169 | */ |
| 170 | void |
| 171 | addCertificateAsIdentityDefault(const IdentityCertificate& certificate); |
| 172 | |
| 173 | /** |
| 174 | * Add a certificate into the public key identity storage and set the certificate as the default of its corresponding key. |
| 175 | * @param certificate The certificate to be added. This makes a copy of the certificate. |
| 176 | */ |
| 177 | void |
| 178 | addCertificateAsDefault(const IdentityCertificate& certificate); |
| 179 | |
| 180 | /** |
| 181 | * Get a certificate with the specified name. |
| 182 | * @param certificateName The name of the requested certificate. |
| 183 | * @return the requested certificate which is valid. |
| 184 | */ |
| 185 | ptr_lib::shared_ptr<IdentityCertificate> |
| 186 | getCertificate(const Name& certificateName) |
Alexander Afanasyev | bf1a67a | 2014-01-05 23:36:13 -0800 | [diff] [blame] | 187 | { |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 188 | return info().getCertificate(certificateName, false); |
| 189 | } |
| 190 | |
| 191 | /** |
| 192 | * Get a certificate even if the certificate is not valid anymore. |
| 193 | * @param certificateName The name of the requested certificate. |
| 194 | * @return the requested certificate. |
| 195 | */ |
| 196 | ptr_lib::shared_ptr<IdentityCertificate> |
| 197 | getAnyCertificate(const Name& certificateName) |
| 198 | { |
| 199 | return info().getCertificate(certificateName, true); |
| 200 | } |
| 201 | |
| 202 | /** |
| 203 | * Get the default certificate name for the specified identity, which will be used when signing is performed based on identity. |
| 204 | * @param identityName The name of the specified identity. |
| 205 | * @return The requested certificate name. |
| 206 | */ |
| 207 | Name |
| 208 | getDefaultCertificateNameForIdentity(const Name& identityName) |
| 209 | { |
| 210 | return info().getDefaultCertificateNameForIdentity(identityName); |
| 211 | } |
| 212 | |
| 213 | /** |
| 214 | * Get the default certificate name of the default identity, which will be used when signing is based on identity and |
| 215 | * the identity is not specified. |
| 216 | * @return The requested certificate name. |
| 217 | */ |
| 218 | Name |
| 219 | getDefaultCertificateName() |
| 220 | { |
| 221 | return info().getDefaultCertificateNameForIdentity(getDefaultIdentity()); |
Alexander Afanasyev | bf1a67a | 2014-01-05 23:36:13 -0800 | [diff] [blame] | 222 | } |
| 223 | |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 224 | void |
| 225 | sign(Data &data); |
Alexander Afanasyev | e64788e | 2014-01-05 22:38:21 -0800 | [diff] [blame] | 226 | |
Jeff Thompson | 47c93cf | 2013-08-09 00:38:48 -0700 | [diff] [blame] | 227 | /** |
Jeff Thompson | 2ce8f49 | 2013-09-17 18:01:25 -0700 | [diff] [blame] | 228 | * Wire encode the Data object, sign it and set its signature. |
Jeff Thompson | 2ce8f49 | 2013-09-17 18:01:25 -0700 | [diff] [blame] | 229 | * @param data The Data object to be signed. This updates its signature and key locator field and wireEncoding. |
Jeff Thompson | 9296f0c | 2013-09-23 18:10:27 -0700 | [diff] [blame] | 230 | * @param certificateName The certificate name of the key to use for signing. If omitted, infer the signing identity from the data packet name. |
Jeff Thompson | 3c73da4 | 2013-08-12 11:19:05 -0700 | [diff] [blame] | 231 | */ |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 232 | void |
Alexander Afanasyev | 64a3d81 | 2014-01-05 23:35:05 -0800 | [diff] [blame] | 233 | sign(Data& data, const Name& certificateName); |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 234 | |
| 235 | void |
| 236 | sign(Data& data, const IdentityCertificate& certificate); |
Jeff Thompson | 79a2d5d | 2013-09-27 14:32:23 -0700 | [diff] [blame] | 237 | |
Jeff Thompson | 29ce310 | 2013-09-27 11:47:48 -0700 | [diff] [blame] | 238 | /** |
Jeff Thompson | c01e178 | 2013-10-21 14:08:42 -0700 | [diff] [blame] | 239 | * Sign the byte array using a certificate name and return a Signature object. |
| 240 | * @param buffer The byte array to be signed. |
| 241 | * @param bufferLength the length of buffer. |
| 242 | * @param certificateName The certificate name used to get the signing key and which will be put into KeyLocator. |
| 243 | * @return The Signature. |
| 244 | */ |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 245 | Signature |
Jeff Thompson | c01e178 | 2013-10-21 14:08:42 -0700 | [diff] [blame] | 246 | sign(const uint8_t* buffer, size_t bufferLength, const Name& certificateName); |
| 247 | |
| 248 | /** |
Jeff Thompson | 29ce310 | 2013-09-27 11:47:48 -0700 | [diff] [blame] | 249 | * Wire encode the Data object, sign it and set its signature. |
Jeff Thompson | 29ce310 | 2013-09-27 11:47:48 -0700 | [diff] [blame] | 250 | * @param data The Data object to be signed. This updates its signature and key locator field and wireEncoding. |
| 251 | * @param identityName The identity name for the key to use for signing. If omitted, infer the signing identity from the data packet name. |
Jeff Thompson | 29ce310 | 2013-09-27 11:47:48 -0700 | [diff] [blame] | 252 | */ |
| 253 | void |
Alexander Afanasyev | 64a3d81 | 2014-01-05 23:35:05 -0800 | [diff] [blame] | 254 | signByIdentity(Data& data, const Name& identityName = Name()); |
Jeff Thompson | 3c73da4 | 2013-08-12 11:19:05 -0700 | [diff] [blame] | 255 | |
| 256 | /** |
Jeff Thompson | c01e178 | 2013-10-21 14:08:42 -0700 | [diff] [blame] | 257 | * Sign the byte array using an identity name and return a Signature object. |
| 258 | * @param buffer The byte array to be signed. |
| 259 | * @param bufferLength the length of buffer. |
| 260 | * @param identityName The identity name. |
| 261 | * @return The Signature. |
| 262 | */ |
Alexander Afanasyev | 64a3d81 | 2014-01-05 23:35:05 -0800 | [diff] [blame] | 263 | Signature |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 264 | signByIdentity(const uint8_t* buffer, size_t bufferLength, const Name& identityName = Name()); |
Jeff Thompson | c01e178 | 2013-10-21 14:08:42 -0700 | [diff] [blame] | 265 | |
| 266 | /** |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 267 | * Generate a self-signed certificate for a public key. |
| 268 | * @param keyName The name of the public key. |
| 269 | * @return The generated certificate. |
| 270 | */ |
| 271 | ptr_lib::shared_ptr<IdentityCertificate> |
| 272 | selfSign(const Name& keyName); |
| 273 | |
| 274 | /** |
| 275 | * @brief Self-sign the supplied identity certificate |
Jeff Thompson | 8efe5ad | 2013-08-20 17:36:38 -0700 | [diff] [blame] | 276 | */ |
Jeff Thompson | 2ce8f49 | 2013-09-17 18:01:25 -0700 | [diff] [blame] | 277 | void |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 278 | selfSign (IdentityCertificate& cert); |
Jeff Thompson | 8efe5ad | 2013-08-20 17:36:38 -0700 | [diff] [blame] | 279 | |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 280 | private: |
| 281 | /** |
| 282 | * Generate a key pair for the specified identity. |
| 283 | * @param identityName The name of the specified identity. |
| 284 | * @param isKsk true for generating a Key-Signing-Key (KSK), false for a Data-Signing-Key (KSK). |
| 285 | * @param keyType The type of the key pair, e.g. KEY_TYPE_RSA. |
| 286 | * @param keySize The size of the key pair. |
| 287 | * @return The name of the generated key. |
| 288 | */ |
| 289 | Name |
| 290 | generateKeyPair(const Name& identityName, bool isKsk = false, KeyType keyType = KEY_TYPE_RSA, int keySize = 2048); |
| 291 | |
| 292 | static Name |
| 293 | getKeyNameFromCertificatePrefix(const Name& certificatePrefix); |
Alexander Afanasyev | bf1a67a | 2014-01-05 23:36:13 -0800 | [diff] [blame] | 294 | |
| 295 | public: |
Alexander Afanasyev | bd5ba40 | 2014-01-05 22:41:09 -0800 | [diff] [blame] | 296 | static const ptr_lib::shared_ptr<IdentityStorage> DefaultIdentityStorage; |
| 297 | static const ptr_lib::shared_ptr<PrivateKeyStorage> DefaultPrivateKeyStorage; |
Alexander Afanasyev | bf1a67a | 2014-01-05 23:36:13 -0800 | [diff] [blame] | 298 | |
Jeff Thompson | 2ce8f49 | 2013-09-17 18:01:25 -0700 | [diff] [blame] | 299 | private: |
Alexander Afanasyev | bd5ba40 | 2014-01-05 22:41:09 -0800 | [diff] [blame] | 300 | ptr_lib::shared_ptr<IdentityStorage> publicInfoStorage_; |
| 301 | ptr_lib::shared_ptr<PrivateKeyStorage> privateKeyStorage_; |
Alexander Afanasyev | bd5ba40 | 2014-01-05 22:41:09 -0800 | [diff] [blame] | 302 | |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 303 | ptr_lib::shared_ptr<IdentityCertificate> defaultCertificate_; |
Jeff Thompson | 47c93cf | 2013-08-09 00:38:48 -0700 | [diff] [blame] | 304 | }; |
| 305 | |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 306 | |
| 307 | inline IdentityStorage& |
| 308 | KeyChain::info() |
Alexander Afanasyev | e64788e | 2014-01-05 22:38:21 -0800 | [diff] [blame] | 309 | { |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 310 | if (!publicInfoStorage_) |
| 311 | throw Error("IdentityStorage is not assigned to IdentityManager"); |
| 312 | |
| 313 | return *publicInfoStorage_; |
Alexander Afanasyev | e64788e | 2014-01-05 22:38:21 -0800 | [diff] [blame] | 314 | } |
| 315 | |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 316 | inline const IdentityStorage& |
| 317 | KeyChain::info() const |
Alexander Afanasyev | e64788e | 2014-01-05 22:38:21 -0800 | [diff] [blame] | 318 | { |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 319 | if (!publicInfoStorage_) |
| 320 | throw Error("IdentityStorage is not assigned to IdentityManager"); |
| 321 | |
| 322 | return *publicInfoStorage_; |
Alexander Afanasyev | e64788e | 2014-01-05 22:38:21 -0800 | [diff] [blame] | 323 | } |
| 324 | |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 325 | inline PrivateKeyStorage& |
| 326 | KeyChain::tpm() |
Alexander Afanasyev | e64788e | 2014-01-05 22:38:21 -0800 | [diff] [blame] | 327 | { |
Yingdi Yu | 2abd73f | 2014-01-08 23:34:11 -0800 | [diff] [blame] | 328 | if (!privateKeyStorage_) |
| 329 | throw Error("PrivateKeyStorage is not assigned to IdentityManager"); |
| 330 | |
| 331 | return *privateKeyStorage_; |
| 332 | } |
| 333 | |
| 334 | inline const PrivateKeyStorage& |
| 335 | KeyChain::tpm() const |
| 336 | { |
| 337 | if (!privateKeyStorage_) |
| 338 | throw Error("PrivateKeyStorage is not assigned to IdentityManager"); |
| 339 | return *privateKeyStorage_; |
Alexander Afanasyev | e64788e | 2014-01-05 22:38:21 -0800 | [diff] [blame] | 340 | } |
| 341 | |
Jeff Thompson | 47c93cf | 2013-08-09 00:38:48 -0700 | [diff] [blame] | 342 | } |
| 343 | |
| 344 | #endif |