Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /** |
Alexander Afanasyev | dfa52c4 | 2014-04-24 21:10:11 -0700 | [diff] [blame] | 3 | * Copyright (c) 2013-2014, Regents of the University of California. |
| 4 | * All rights reserved. |
| 5 | * |
| 6 | * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). |
| 7 | * See AUTHORS.md for complete list of ndn-cxx authors and contributors. |
| 8 | * |
| 9 | * This file licensed under New BSD License. See COPYING for detailed information about |
| 10 | * ndn-cxx library copyright, permissions, and redistribution restrictions. |
| 11 | * |
| 12 | * @author Yingdi Yu <http://irl.cs.ucla.edu/~yingdi/> |
| 13 | * @author Jeff Thompson <jefft0@remap.ucla.edu> |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 14 | */ |
| 15 | |
Yingdi Yu | fc40d87 | 2014-02-18 12:56:04 -0800 | [diff] [blame] | 16 | #ifndef NDN_SECURITY_SEC_PUBLIC_INFO_HPP |
| 17 | #define NDN_SECURITY_SEC_PUBLIC_INFO_HPP |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 18 | |
Yingdi Yu | 4f32463 | 2014-01-15 18:10:03 -0800 | [diff] [blame] | 19 | #include "../name.hpp" |
| 20 | #include "security-common.hpp" |
| 21 | #include "public-key.hpp" |
| 22 | #include "identity-certificate.hpp" |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 23 | |
Yingdi Yu | 88663af | 2014-01-15 15:21:38 -0800 | [diff] [blame] | 24 | |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 25 | namespace ndn { |
| 26 | |
| 27 | /** |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 28 | * @brief SecPublicInfo is a base class for the storage of public information. |
| 29 | * |
Yingdi Yu | 4b8c6a2 | 2014-04-15 23:00:54 -0700 | [diff] [blame] | 30 | * It specify interfaces related to public information, such as identity, public keys and |
| 31 | * certificates. |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 32 | */ |
Yingdi Yu | f56c68f | 2014-04-24 21:50:13 -0700 | [diff] [blame] | 33 | class SecPublicInfo : noncopyable |
Alexander Afanasyev | 2a7f720 | 2014-04-23 14:25:29 -0700 | [diff] [blame] | 34 | { |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 35 | public: |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 36 | class Error : public std::runtime_error |
| 37 | { |
| 38 | public: |
| 39 | explicit |
| 40 | Error(const std::string& what) |
| 41 | : std::runtime_error(what) |
| 42 | { |
| 43 | } |
| 44 | }; |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 45 | |
| 46 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 47 | * @brief The virtual Destructor |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 48 | */ |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 49 | virtual |
Yingdi Yu | f56c68f | 2014-04-24 21:50:13 -0700 | [diff] [blame] | 50 | ~SecPublicInfo() |
| 51 | { |
| 52 | } |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 53 | |
| 54 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 55 | * @brief Check if the specified identity already exists |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 56 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 57 | * @param identityName The identity name |
| 58 | * @return true if the identity exists, otherwise false |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 59 | */ |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 60 | virtual bool |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 61 | doesIdentityExist(const Name& identityName) = 0; |
| 62 | |
| 63 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 64 | * @brief Add a new identity |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 65 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 66 | * if identity already exist, do not add it again |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 67 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 68 | * @param identityName The identity name to be added |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 69 | */ |
| 70 | virtual void |
| 71 | addIdentity(const Name& identityName) = 0; |
| 72 | |
| 73 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 74 | * @brief Revoke the identity |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 75 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 76 | * @return true if the identity was revoked, otherwise false |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 77 | */ |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 78 | virtual bool |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 79 | revokeIdentity() = 0; |
| 80 | |
| 81 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 82 | * @brief Check if the specified key already exists |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 83 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 84 | * @param keyName The name of the key |
| 85 | * @return true if the key exists, otherwise false |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 86 | */ |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 87 | virtual bool |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 88 | doesPublicKeyExist(const Name& keyName) = 0; |
| 89 | |
| 90 | /** |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 91 | * @brief Add a public key to the identity storage. |
| 92 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 93 | * @param keyName The name of the public key to be added |
| 94 | * @param keyType Type of the public key to be added |
| 95 | * @param publicKey Reference to the PublicKey object |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 96 | */ |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 97 | virtual void |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 98 | addPublicKey(const Name& keyName, KeyType keyType, const PublicKey& publicKey) = 0; |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 99 | |
| 100 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 101 | * @brief Get shared pointer to PublicKey object from the identity storage |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 102 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 103 | * @param keyName The name of the requested public key |
| 104 | * @throws SecPublicInfo::Error if public key does not exist |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 105 | */ |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 106 | virtual shared_ptr<PublicKey> |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 107 | getPublicKey(const Name& keyName) = 0; |
| 108 | |
| 109 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 110 | * @brief Check if the specified certificate already exists |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 111 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 112 | * @param certificateName The name of the certificate |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 113 | */ |
| 114 | virtual bool |
| 115 | doesCertificateExist(const Name& certificateName) = 0; |
| 116 | |
| 117 | /** |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 118 | * @brief Add a certificate to the identity storage. |
| 119 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 120 | * It will add the corresponding public key and identity if they do not exist |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 121 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 122 | * @param certificate The certificate to be added |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 123 | */ |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 124 | virtual void |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 125 | addCertificate(const IdentityCertificate& certificate) = 0; |
| 126 | |
| 127 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 128 | * @brief Get a shared pointer to identity certificate object from the identity storage |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 129 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 130 | * @param certificateName The name of the requested certificate |
| 131 | * @throws SecPublicInfo::Error if the certificate does not exist |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 132 | */ |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 133 | virtual shared_ptr<IdentityCertificate> |
| 134 | getCertificate(const Name& certificateName) = 0; |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 135 | |
| 136 | |
| 137 | /***************************************** |
| 138 | * Default Getter * |
| 139 | *****************************************/ |
| 140 | |
| 141 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 142 | * @brief Get name of the default identity |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 143 | * |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 144 | * @throws SecPublicInfo::Error if there is no default. |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 145 | */ |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 146 | virtual Name |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 147 | getDefaultIdentity() = 0; |
| 148 | |
| 149 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 150 | * @brief Get name of the default key name for the specified identity |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 151 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 152 | * @param identityName The identity name |
| 153 | * @throws SecPublicInfo::Error if there is no default |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 154 | */ |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 155 | virtual Name |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 156 | getDefaultKeyNameForIdentity(const Name& identityName) = 0; |
| 157 | |
| 158 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 159 | * @brief Get name of the default certificate name for the specified key |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 160 | * |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 161 | * @param keyName The key name. |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 162 | * @throws SecPublicInfo::Error if there is no default. |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 163 | */ |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 164 | virtual Name |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 165 | getDefaultCertificateNameForKey(const Name& keyName) = 0; |
| 166 | |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 167 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 168 | * @brief Get all the identities from public info |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 169 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 170 | * @param [out] nameList On return, the identity list |
| 171 | * @param isDefault If specified, only the default identity is returned |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 172 | */ |
Yingdi Yu | 28fd32f | 2014-01-28 19:03:03 -0800 | [diff] [blame] | 173 | virtual void |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 174 | getAllIdentities(std::vector<Name>& nameList, bool isDefault) = 0; |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 175 | |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 176 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 177 | * @brief Get all the key names from public info |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 178 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 179 | * @param [out] nameList On return, the key name list. |
| 180 | * @param isDefault If specified, only the default keys are returned |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 181 | */ |
Yingdi Yu | 28fd32f | 2014-01-28 19:03:03 -0800 | [diff] [blame] | 182 | virtual void |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 183 | getAllKeyNames(std::vector<Name>& nameList, bool isDefault) = 0; |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 184 | |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 185 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 186 | * @brief Get all the key names of a particular identity |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 187 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 188 | * @param identity The specified identity name |
| 189 | * @param [out] nameList On return, the key name list |
| 190 | * @param isDefault If specified, only the default key is returned |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 191 | */ |
Yingdi Yu | 28fd32f | 2014-01-28 19:03:03 -0800 | [diff] [blame] | 192 | virtual void |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 193 | getAllKeyNamesOfIdentity(const Name& identity, std::vector<Name>& nameList, bool isDefault) = 0; |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 194 | |
| 195 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 196 | * @brief Get all the certificate name in public info |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 197 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 198 | * @param [out] nameList On return, the certificate name list |
| 199 | * @param isDefault If specified, only the default certificates are returned |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 200 | */ |
Yingdi Yu | 28fd32f | 2014-01-28 19:03:03 -0800 | [diff] [blame] | 201 | virtual void |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 202 | getAllCertificateNames(std::vector<Name>& nameList, bool isDefault) = 0; |
| 203 | |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 204 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 205 | * @brief Get all the certificate name of a particular key name |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 206 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 207 | * @param keyName The specified key name |
| 208 | * @param [out] nameList On return, the certificate name list |
| 209 | * @param isDefault If specified, only the default certificate is returned |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 210 | */ |
Yingdi Yu | 28fd32f | 2014-01-28 19:03:03 -0800 | [diff] [blame] | 211 | virtual void |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 212 | getAllCertificateNamesOfKey(const Name& keyName, std::vector<Name>& nameList, bool isDefault) = 0; |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 213 | |
Yingdi Yu | f56c68f | 2014-04-24 21:50:13 -0700 | [diff] [blame] | 214 | /***************************************** |
| 215 | * Delete Methods * |
| 216 | *****************************************/ |
| 217 | |
| 218 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 219 | * @brief Delete a certificate |
Yingdi Yu | f56c68f | 2014-04-24 21:50:13 -0700 | [diff] [blame] | 220 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 221 | * @param certificateName The certificate name |
Yingdi Yu | f56c68f | 2014-04-24 21:50:13 -0700 | [diff] [blame] | 222 | */ |
| 223 | virtual void |
| 224 | deleteCertificateInfo(const Name& certificateName) = 0; |
| 225 | |
| 226 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 227 | * @brief Delete a public key and related certificates |
Yingdi Yu | f56c68f | 2014-04-24 21:50:13 -0700 | [diff] [blame] | 228 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 229 | * @param keyName The key name |
Yingdi Yu | f56c68f | 2014-04-24 21:50:13 -0700 | [diff] [blame] | 230 | */ |
| 231 | virtual void |
| 232 | deletePublicKeyInfo(const Name& keyName) = 0; |
| 233 | |
| 234 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 235 | * @brief Delete an identity and related public keys and certificates |
Yingdi Yu | f56c68f | 2014-04-24 21:50:13 -0700 | [diff] [blame] | 236 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 237 | * @param identity The identity name |
Yingdi Yu | f56c68f | 2014-04-24 21:50:13 -0700 | [diff] [blame] | 238 | */ |
| 239 | virtual void |
| 240 | deleteIdentityInfo(const Name& identity) = 0; |
| 241 | |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 242 | protected: |
| 243 | |
| 244 | /***************************************** |
| 245 | * Default Setter * |
| 246 | *****************************************/ |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 247 | |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 248 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 249 | * @brief Set the default identity |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 250 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 251 | * @param identityName The default identity name |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 252 | */ |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 253 | virtual void |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 254 | setDefaultIdentityInternal(const Name& identityName) = 0; |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 255 | |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 256 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 257 | * @brief Set the default key name for the corresponding identity |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 258 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 259 | * @param keyName The key name |
| 260 | * @throws SecPublicInfo::Error if the key does not exist |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 261 | */ |
| 262 | virtual void |
| 263 | setDefaultKeyNameForIdentityInternal(const Name& keyName) = 0; |
| 264 | |
| 265 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 266 | * @brief Set the default certificate name for the corresponding key |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 267 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 268 | * @param certificateName The certificate name |
| 269 | * @throws SecPublicInfo::Error if the certificate does not exist |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 270 | */ |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 271 | virtual void |
| 272 | setDefaultCertificateNameForKeyInternal(const Name& certificateName) = 0; |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 273 | |
| 274 | public: |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 275 | |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 276 | /***************************************** |
| 277 | * Helper Methods * |
| 278 | *****************************************/ |
| 279 | |
| 280 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 281 | * @brief Set the default identity |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 282 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 283 | * @param identityName The default identity name |
| 284 | * @throws SecPublicInfo::Error if the identity does not exist |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 285 | */ |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 286 | inline void |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 287 | setDefaultIdentity(const Name& identityName); |
| 288 | |
| 289 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 290 | * @brief Set the default key name for the corresponding identity |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 291 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 292 | * @param keyName The key name |
| 293 | * @throws SecPublicInfo::Error if either the identity or key does not exist |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 294 | */ |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 295 | inline void |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 296 | setDefaultKeyNameForIdentity(const Name& keyName); |
| 297 | |
| 298 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 299 | * @brief Set the default certificate name for the corresponding key |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 300 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 301 | * @param certificateName The certificate name |
| 302 | * @throws SecPublicInfo::Error if either the certificate or key does not exist |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 303 | */ |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 304 | inline void |
| 305 | setDefaultCertificateNameForKey(const Name& certificateName); |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 306 | |
| 307 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 308 | * @brief Generate a key name for the identity |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 309 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 310 | * @param identityName The identity name |
| 311 | * @param useKsk If true, generate a KSK name, otherwise a DSK name |
| 312 | * @return The generated key name |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 313 | */ |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 314 | inline Name |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 315 | getNewKeyName(const Name& identityName, bool useKsk); |
| 316 | |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 317 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 318 | * @brief Get the default certificate name for the specified identity |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 319 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 320 | * @param identityName The identity name |
| 321 | * @return The default certificate name |
| 322 | * @throws SecPublicInfo::Error if no certificate is found |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 323 | */ |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 324 | inline Name |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 325 | getDefaultCertificateNameForIdentity(const Name& identityName); |
| 326 | |
| 327 | /** |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 328 | * @brief Get the default certificate name of the default identity |
| 329 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 330 | * @return The requested certificate name |
| 331 | * @throws SecPublicInfo::Error if no certificate is found |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 332 | */ |
| 333 | inline Name |
| 334 | getDefaultCertificateName(); |
| 335 | |
| 336 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 337 | * @brief Add a certificate and set the certificate as the default one of its corresponding key |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 338 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 339 | * @param certificate The certificate to be added |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 340 | * @throws SecPublicInfo::Error if the certificate cannot be added (though it is really rare) |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 341 | */ |
| 342 | inline void |
| 343 | addCertificateAsKeyDefault(const IdentityCertificate& certificate); |
| 344 | |
| 345 | /** |
Yingdi Yu | 4b8c6a2 | 2014-04-15 23:00:54 -0700 | [diff] [blame] | 346 | * @brief Add a certificate into the public key identity storage and set the certificate as the |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 347 | * default one of its corresponding identity |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 348 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 349 | * @param certificate The certificate to be added |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 350 | * @throws SecPublicInfo::Error if the certificate cannot be added (though it is really rare) |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 351 | */ |
| 352 | inline void |
| 353 | addCertificateAsIdentityDefault(const IdentityCertificate& certificate); |
| 354 | |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 355 | /** |
Yingdi Yu | 4b8c6a2 | 2014-04-15 23:00:54 -0700 | [diff] [blame] | 356 | * @brief Add a certificate into the public key identity storage and set the certificate as the |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 357 | * default one of the default identity |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 358 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 359 | * @param certificate The certificate to be added |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 360 | * @throws SecPublicInfo::Error if the certificate cannot be added (though it is really rare) |
| 361 | */ |
Yingdi Yu | 88663af | 2014-01-15 15:21:38 -0800 | [diff] [blame] | 362 | inline void |
| 363 | addCertificateAsSystemDefault(const IdentityCertificate& certificate); |
| 364 | |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 365 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 366 | * @brief Get cached default certificate of the default identity |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 367 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 368 | * @return The certificate which might be empty shared_ptr<IdentityCertificate>() |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 369 | */ |
| 370 | inline shared_ptr<IdentityCertificate> |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 371 | defaultCertificate(); |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 372 | |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 373 | /** |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame^] | 374 | * @brief try to get the default certificate of the default identity from the public info |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 375 | */ |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 376 | inline void |
| 377 | refreshDefaultCertificate(); |
| 378 | |
| 379 | protected: |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 380 | shared_ptr<IdentityCertificate> m_defaultCertificate; |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 381 | }; |
| 382 | |
Yingdi Yu | f8fc8de | 2014-02-25 15:45:39 -0800 | [diff] [blame] | 383 | inline void |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 384 | SecPublicInfo::setDefaultIdentity(const Name& identityName) |
| 385 | { |
| 386 | setDefaultIdentityInternal(identityName); |
| 387 | refreshDefaultCertificate(); |
| 388 | } |
| 389 | |
Yingdi Yu | f8fc8de | 2014-02-25 15:45:39 -0800 | [diff] [blame] | 390 | inline void |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 391 | SecPublicInfo::setDefaultKeyNameForIdentity(const Name& keyName) |
| 392 | { |
| 393 | setDefaultKeyNameForIdentityInternal(keyName); |
| 394 | refreshDefaultCertificate(); |
| 395 | } |
| 396 | |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 397 | inline void |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 398 | SecPublicInfo::setDefaultCertificateNameForKey(const Name& certificateName) |
| 399 | { |
| 400 | setDefaultCertificateNameForKeyInternal(certificateName); |
| 401 | refreshDefaultCertificate(); |
| 402 | } |
| 403 | |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 404 | inline Name |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 405 | SecPublicInfo::getDefaultCertificateNameForIdentity(const Name& identityName) |
| 406 | { |
| 407 | return getDefaultCertificateNameForKey(getDefaultKeyNameForIdentity(identityName)); |
| 408 | } |
| 409 | |
Yingdi Yu | f8fc8de | 2014-02-25 15:45:39 -0800 | [diff] [blame] | 410 | inline Name |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 411 | SecPublicInfo::getNewKeyName (const Name& identityName, bool useKsk) |
| 412 | { |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 413 | std::ostringstream oss; |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 414 | |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 415 | if (useKsk) |
Yingdi Yu | 88663af | 2014-01-15 15:21:38 -0800 | [diff] [blame] | 416 | oss << "ksk-"; |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 417 | else |
Yingdi Yu | 88663af | 2014-01-15 15:21:38 -0800 | [diff] [blame] | 418 | oss << "dsk-"; |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 419 | |
Alexander Afanasyev | aa0e7da | 2014-03-17 14:37:33 -0700 | [diff] [blame] | 420 | oss << time::toUnixTimestamp(time::system_clock::now()).count(); |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 421 | |
Yingdi Yu | 88663af | 2014-01-15 15:21:38 -0800 | [diff] [blame] | 422 | Name keyName = Name(identityName).append(oss.str()); |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 423 | |
| 424 | if (doesPublicKeyExist(keyName)) |
Yingdi Yu | 28fd32f | 2014-01-28 19:03:03 -0800 | [diff] [blame] | 425 | throw Error("Key name already exists: " + keyName.toUri()); |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 426 | |
| 427 | return keyName; |
| 428 | } |
| 429 | |
Yingdi Yu | f8fc8de | 2014-02-25 15:45:39 -0800 | [diff] [blame] | 430 | inline Name |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 431 | SecPublicInfo::getDefaultCertificateName() |
| 432 | { |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 433 | if (!static_cast<bool>(m_defaultCertificate)) |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 434 | refreshDefaultCertificate(); |
| 435 | |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 436 | if (!static_cast<bool>(m_defaultCertificate)) |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 437 | throw Error("No default certificate is set"); |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 438 | |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 439 | return m_defaultCertificate->getName(); |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 440 | } |
| 441 | |
Yingdi Yu | f8fc8de | 2014-02-25 15:45:39 -0800 | [diff] [blame] | 442 | inline void |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 443 | SecPublicInfo::addCertificateAsKeyDefault(const IdentityCertificate& certificate) |
| 444 | { |
| 445 | addCertificate(certificate); |
| 446 | setDefaultCertificateNameForKeyInternal(certificate.getName()); |
| 447 | refreshDefaultCertificate(); |
| 448 | } |
| 449 | |
Yingdi Yu | f8fc8de | 2014-02-25 15:45:39 -0800 | [diff] [blame] | 450 | inline void |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 451 | SecPublicInfo::addCertificateAsIdentityDefault(const IdentityCertificate& certificate) |
| 452 | { |
| 453 | addCertificate(certificate); |
Yingdi Yu | 88663af | 2014-01-15 15:21:38 -0800 | [diff] [blame] | 454 | Name certName = certificate.getName(); |
Yingdi Yu | 4b8c6a2 | 2014-04-15 23:00:54 -0700 | [diff] [blame] | 455 | Name keyName = IdentityCertificate::certificateNameToPublicKeyName(certName); |
| 456 | setDefaultKeyNameForIdentityInternal(keyName); |
Yingdi Yu | 88663af | 2014-01-15 15:21:38 -0800 | [diff] [blame] | 457 | setDefaultCertificateNameForKeyInternal(certName); |
| 458 | refreshDefaultCertificate(); |
| 459 | } |
| 460 | |
Yingdi Yu | f8fc8de | 2014-02-25 15:45:39 -0800 | [diff] [blame] | 461 | inline void |
Yingdi Yu | 88663af | 2014-01-15 15:21:38 -0800 | [diff] [blame] | 462 | SecPublicInfo::addCertificateAsSystemDefault(const IdentityCertificate& certificate) |
| 463 | { |
| 464 | addCertificate(certificate); |
| 465 | Name certName = certificate.getName(); |
| 466 | Name keyName = IdentityCertificate::certificateNameToPublicKeyName(certName); |
| 467 | setDefaultIdentityInternal(keyName.getPrefix(-1)); |
| 468 | setDefaultKeyNameForIdentityInternal(keyName); |
| 469 | setDefaultCertificateNameForKeyInternal(certName); |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 470 | refreshDefaultCertificate(); |
| 471 | } |
| 472 | |
Yingdi Yu | f8fc8de | 2014-02-25 15:45:39 -0800 | [diff] [blame] | 473 | inline shared_ptr<IdentityCertificate> |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 474 | SecPublicInfo::defaultCertificate() |
| 475 | { |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 476 | return m_defaultCertificate; |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 477 | } |
| 478 | |
Yingdi Yu | f8fc8de | 2014-02-25 15:45:39 -0800 | [diff] [blame] | 479 | inline void |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 480 | SecPublicInfo::refreshDefaultCertificate() |
| 481 | { |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 482 | try |
| 483 | { |
| 484 | Name certName = getDefaultCertificateNameForIdentity(getDefaultIdentity()); |
| 485 | m_defaultCertificate = getCertificate(certName); |
| 486 | } |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 487 | catch (SecPublicInfo::Error& e) |
Yingdi Yu | 2e57a58 | 2014-02-20 23:34:43 -0800 | [diff] [blame] | 488 | { |
| 489 | m_defaultCertificate.reset(); |
| 490 | } |
| 491 | |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 492 | } |
| 493 | |
Yingdi Yu | fc40d87 | 2014-02-18 12:56:04 -0800 | [diff] [blame] | 494 | } // namespace ndn |
Yingdi Yu | 31b4af2 | 2014-01-14 14:13:00 -0800 | [diff] [blame] | 495 | |
Yingdi Yu | fc40d87 | 2014-02-18 12:56:04 -0800 | [diff] [blame] | 496 | #endif //NDN_SECURITY_SEC_PUBLIC_INFO_HPP |