| 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 SYNC_UTIL_CRYPTOGRAPHER_H_ | 5 #ifndef SYNC_UTIL_CRYPTOGRAPHER_H_ |
| 6 #define SYNC_UTIL_CRYPTOGRAPHER_H_ | 6 #define SYNC_UTIL_CRYPTOGRAPHER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // Cryptographer instance to bootstrap itself. Returns false if such a token | 169 // Cryptographer instance to bootstrap itself. Returns false if such a token |
| 170 // can't be created (i.e. if this Cryptograhper doesn't have valid keys). | 170 // can't be created (i.e. if this Cryptograhper doesn't have valid keys). |
| 171 bool GetBootstrapToken(std::string* token) const; | 171 bool GetBootstrapToken(std::string* token) const; |
| 172 | 172 |
| 173 Encryptor* encryptor() const { return encryptor_; } | 173 Encryptor* encryptor() const { return encryptor_; } |
| 174 | 174 |
| 175 // Returns true if |keybag| is decryptable and either is a subset of nigoris_ | 175 // Returns true if |keybag| is decryptable and either is a subset of nigoris_ |
| 176 // and/or has a different default key. | 176 // and/or has a different default key. |
| 177 bool KeybagIsStale(const sync_pb::EncryptedData& keybag) const; | 177 bool KeybagIsStale(const sync_pb::EncryptedData& keybag) const; |
| 178 | 178 |
| 179 // Returns the name of the Nigori key currently used for encryption. |
| 180 std::string GetDefaultNigoriKeyName() const; |
| 181 |
| 179 // Returns a serialized sync_pb::NigoriKey version of current default | 182 // Returns a serialized sync_pb::NigoriKey version of current default |
| 180 // encryption key. | 183 // encryption key. |
| 181 std::string GetDefaultNigoriKey() const; | 184 std::string GetDefaultNigoriKeyData() const; |
| 182 | 185 |
| 183 // Generates a new Nigori from |serialized_nigori_key|, and if successful | 186 // Generates a new Nigori from |serialized_nigori_key|, and if successful |
| 184 // installs the new nigori as the default key. | 187 // installs the new nigori as the default key. |
| 185 bool ImportNigoriKey(const std::string serialized_nigori_key); | 188 bool ImportNigoriKey(const std::string serialized_nigori_key); |
| 186 | 189 |
| 187 private: | 190 private: |
| 188 typedef std::map<std::string, linked_ptr<const Nigori> > NigoriMap; | 191 typedef std::map<std::string, linked_ptr<const Nigori> > NigoriMap; |
| 189 | 192 |
| 190 // Helper method to instantiate Nigori instances for each set of key | 193 // Helper method to instantiate Nigori instances for each set of key |
| 191 // parameters in |bag|. | 194 // parameters in |bag|. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 208 std::string default_nigori_name_; | 211 std::string default_nigori_name_; |
| 209 | 212 |
| 210 scoped_ptr<sync_pb::EncryptedData> pending_keys_; | 213 scoped_ptr<sync_pb::EncryptedData> pending_keys_; |
| 211 | 214 |
| 212 DISALLOW_COPY_AND_ASSIGN(Cryptographer); | 215 DISALLOW_COPY_AND_ASSIGN(Cryptographer); |
| 213 }; | 216 }; |
| 214 | 217 |
| 215 } // namespace syncer | 218 } // namespace syncer |
| 216 | 219 |
| 217 #endif // SYNC_UTIL_CRYPTOGRAPHER_H_ | 220 #endif // SYNC_UTIL_CRYPTOGRAPHER_H_ |
| OLD | NEW |