| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 void SetDefaultKey(const std::string& key_name); | 154 void SetDefaultKey(const std::string& key_name); |
| 155 | 155 |
| 156 bool is_initialized() const { | 156 bool is_initialized() const { |
| 157 return !nigoris_.empty() && !default_nigori_name_.empty(); | 157 return !nigoris_.empty() && !default_nigori_name_.empty(); |
| 158 } | 158 } |
| 159 | 159 |
| 160 // Returns whether this Cryptographer is ready to encrypt and decrypt data. | 160 // Returns whether this Cryptographer is ready to encrypt and decrypt data. |
| 161 bool is_ready() const { return is_initialized() && !has_pending_keys(); } | 161 bool is_ready() const { return is_initialized() && !has_pending_keys(); } |
| 162 | 162 |
| 163 // Returns whether there is a pending set of keys that needs to be decrypted. | 163 // Returns whether there is a pending set of keys that needs to be decrypted. |
| 164 bool has_pending_keys() const { return NULL != pending_keys_.get(); } | 164 bool has_pending_keys() const { return nullptr != pending_keys_.get(); } |
| 165 | 165 |
| 166 // Obtain a token that can be provided on construction to a future | 166 // Obtain a token that can be provided on construction to a future |
| 167 // Cryptographer instance to bootstrap itself. Returns false if such a token | 167 // Cryptographer instance to bootstrap itself. Returns false if such a token |
| 168 // can't be created (i.e. if this Cryptograhper doesn't have valid keys). | 168 // can't be created (i.e. if this Cryptograhper doesn't have valid keys). |
| 169 bool GetBootstrapToken(std::string* token) const; | 169 bool GetBootstrapToken(std::string* token) const; |
| 170 | 170 |
| 171 Encryptor* encryptor() const { return encryptor_; } | 171 Encryptor* encryptor() const { return encryptor_; } |
| 172 | 172 |
| 173 // Returns true if |keybag| is decryptable and either is a subset of nigoris_ | 173 // Returns true if |keybag| is decryptable and either is a subset of nigoris_ |
| 174 // and/or has a different default key. | 174 // and/or has a different default key. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 std::string default_nigori_name_; | 210 std::string default_nigori_name_; |
| 211 | 211 |
| 212 std::unique_ptr<sync_pb::EncryptedData> pending_keys_; | 212 std::unique_ptr<sync_pb::EncryptedData> pending_keys_; |
| 213 | 213 |
| 214 DISALLOW_ASSIGN(Cryptographer); | 214 DISALLOW_ASSIGN(Cryptographer); |
| 215 }; | 215 }; |
| 216 | 216 |
| 217 } // namespace syncer | 217 } // namespace syncer |
| 218 | 218 |
| 219 #endif // COMPONENTS_SYNC_BASE_CRYPTOGRAPHER_H_ | 219 #endif // COMPONENTS_SYNC_BASE_CRYPTOGRAPHER_H_ |
| OLD | NEW |