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 | |
182 // Returns a serialized sync_pb::NigoriKey version of current default | 179 // Returns a serialized sync_pb::NigoriKey version of current default |
183 // encryption key. | 180 // encryption key. |
184 std::string GetDefaultNigoriKeyData() const; | 181 std::string GetDefaultNigoriKey() const; |
185 | 182 |
186 // Generates a new Nigori from |serialized_nigori_key|, and if successful | 183 // Generates a new Nigori from |serialized_nigori_key|, and if successful |
187 // installs the new nigori as the default key. | 184 // installs the new nigori as the default key. |
188 bool ImportNigoriKey(const std::string serialized_nigori_key); | 185 bool ImportNigoriKey(const std::string serialized_nigori_key); |
189 | 186 |
190 private: | 187 private: |
191 typedef std::map<std::string, linked_ptr<const Nigori> > NigoriMap; | 188 typedef std::map<std::string, linked_ptr<const Nigori> > NigoriMap; |
192 | 189 |
193 // Helper method to instantiate Nigori instances for each set of key | 190 // Helper method to instantiate Nigori instances for each set of key |
194 // parameters in |bag|. | 191 // parameters in |bag|. |
(...skipping 16 matching lines...) Expand all Loading... |
211 std::string default_nigori_name_; | 208 std::string default_nigori_name_; |
212 | 209 |
213 scoped_ptr<sync_pb::EncryptedData> pending_keys_; | 210 scoped_ptr<sync_pb::EncryptedData> pending_keys_; |
214 | 211 |
215 DISALLOW_COPY_AND_ASSIGN(Cryptographer); | 212 DISALLOW_COPY_AND_ASSIGN(Cryptographer); |
216 }; | 213 }; |
217 | 214 |
218 } // namespace syncer | 215 } // namespace syncer |
219 | 216 |
220 #endif // SYNC_UTIL_CRYPTOGRAPHER_H_ | 217 #endif // SYNC_UTIL_CRYPTOGRAPHER_H_ |
OLD | NEW |