| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_SYNC_BASE_CRYPTOGRAPHER_H_ | 5 #ifndef COMPONENTS_SYNC_BASE_CRYPTOGRAPHER_H_ |
| 6 #define COMPONENTS_SYNC_BASE_CRYPTOGRAPHER_H_ | 6 #define COMPONENTS_SYNC_BASE_CRYPTOGRAPHER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 | 178 |
| 179 // Returns a serialized sync_pb::NigoriKey version of current default | 179 // Returns a serialized sync_pb::NigoriKey version of current default |
| 180 // encryption key. | 180 // encryption key. |
| 181 std::string GetDefaultNigoriKeyData() const; | 181 std::string GetDefaultNigoriKeyData() const; |
| 182 | 182 |
| 183 // Generates a new Nigori from |serialized_nigori_key|, and if successful | 183 // Generates a new Nigori from |serialized_nigori_key|, and if successful |
| 184 // installs the new nigori as the default key. | 184 // installs the new nigori as the default key. |
| 185 bool ImportNigoriKey(const std::string& serialized_nigori_key); | 185 bool ImportNigoriKey(const std::string& serialized_nigori_key); |
| 186 | 186 |
| 187 private: | 187 private: |
| 188 typedef std::map<std::string, linked_ptr<const Nigori>> NigoriMap; | 188 using NigoriMap = std::map<std::string, linked_ptr<const Nigori>>; |
| 189 | 189 |
| 190 // Helper method to instantiate Nigori instances for each set of key | 190 // Helper method to instantiate Nigori instances for each set of key |
| 191 // parameters in |bag|. | 191 // parameters in |bag|. |
| 192 // Does not update the default nigori. | 192 // Does not update the default nigori. |
| 193 void InstallKeyBag(const sync_pb::NigoriKeyBag& bag); | 193 void InstallKeyBag(const sync_pb::NigoriKeyBag& bag); |
| 194 | 194 |
| 195 // Helper method to add a nigori to the keybag, optionally making it the | 195 // Helper method to add a nigori to the keybag, optionally making it the |
| 196 // default as well. | 196 // default as well. |
| 197 bool AddKeyImpl(std::unique_ptr<Nigori> nigori, bool set_as_default); | 197 bool AddKeyImpl(std::unique_ptr<Nigori> nigori, bool set_as_default); |
| 198 | 198 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 209 std::string default_nigori_name_; | 209 std::string default_nigori_name_; |
| 210 | 210 |
| 211 std::unique_ptr<sync_pb::EncryptedData> pending_keys_; | 211 std::unique_ptr<sync_pb::EncryptedData> pending_keys_; |
| 212 | 212 |
| 213 DISALLOW_ASSIGN(Cryptographer); | 213 DISALLOW_ASSIGN(Cryptographer); |
| 214 }; | 214 }; |
| 215 | 215 |
| 216 } // namespace syncer | 216 } // namespace syncer |
| 217 | 217 |
| 218 #endif // COMPONENTS_SYNC_BASE_CRYPTOGRAPHER_H_ | 218 #endif // COMPONENTS_SYNC_BASE_CRYPTOGRAPHER_H_ |
| OLD | NEW |