| OLD | NEW |
| 1 // Copyright (c) 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 |
| 11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "sync/base/sync_export.h" |
| 14 #include "sync/protocol/encryption.pb.h" | 15 #include "sync/protocol/encryption.pb.h" |
| 15 #include "sync/util/nigori.h" | 16 #include "sync/util/nigori.h" |
| 16 | 17 |
| 17 namespace sync_pb { | 18 namespace sync_pb { |
| 18 class NigoriKeyBag; | 19 class NigoriKeyBag; |
| 19 class NigoriSpecifics; | 20 class NigoriSpecifics; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace syncer { | 23 namespace syncer { |
| 23 | 24 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 39 // Whenever an update to the Nigori sync node is received from the server, | 40 // Whenever an update to the Nigori sync node is received from the server, |
| 40 // SetPendingKeys should be called with the encrypted contents of that node. | 41 // SetPendingKeys should be called with the encrypted contents of that node. |
| 41 // Most likely, an updated Nigori node means that a new passphrase has been set | 42 // Most likely, an updated Nigori node means that a new passphrase has been set |
| 42 // and that future node updates won't be decryptable. To remedy this, the user | 43 // and that future node updates won't be decryptable. To remedy this, the user |
| 43 // should be prompted for the new passphrase and DecryptPendingKeys be called. | 44 // should be prompted for the new passphrase and DecryptPendingKeys be called. |
| 44 // | 45 // |
| 45 // Whenever a update to an encrypted node is received from the server, | 46 // Whenever a update to an encrypted node is received from the server, |
| 46 // CanDecrypt should be used to verify whether the Cryptographer can decrypt | 47 // CanDecrypt should be used to verify whether the Cryptographer can decrypt |
| 47 // that node. If it cannot, then the application of that update should be | 48 // that node. If it cannot, then the application of that update should be |
| 48 // delayed until after it can be decrypted. | 49 // delayed until after it can be decrypted. |
| 49 class Cryptographer { | 50 class SYNC_EXPORT Cryptographer { |
| 50 public: | 51 public: |
| 51 // Does not take ownership of |encryptor|. | 52 // Does not take ownership of |encryptor|. |
| 52 explicit Cryptographer(Encryptor* encryptor); | 53 explicit Cryptographer(Encryptor* encryptor); |
| 53 ~Cryptographer(); | 54 ~Cryptographer(); |
| 54 | 55 |
| 55 // |restored_bootstrap_token| can be provided via this method to bootstrap | 56 // |restored_bootstrap_token| can be provided via this method to bootstrap |
| 56 // Cryptographer instance into the ready state (is_ready will be true). | 57 // Cryptographer instance into the ready state (is_ready will be true). |
| 57 // It must be a string that was previously built by the | 58 // It must be a string that was previously built by the |
| 58 // GetSerializedBootstrapToken function. It is possible that the token is no | 59 // GetSerializedBootstrapToken function. It is possible that the token is no |
| 59 // longer valid (due to server key change), in which case the normal | 60 // longer valid (due to server key change), in which case the normal |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 std::string default_nigori_name_; | 208 std::string default_nigori_name_; |
| 208 | 209 |
| 209 scoped_ptr<sync_pb::EncryptedData> pending_keys_; | 210 scoped_ptr<sync_pb::EncryptedData> pending_keys_; |
| 210 | 211 |
| 211 DISALLOW_COPY_AND_ASSIGN(Cryptographer); | 212 DISALLOW_COPY_AND_ASSIGN(Cryptographer); |
| 212 }; | 213 }; |
| 213 | 214 |
| 214 } // namespace syncer | 215 } // namespace syncer |
| 215 | 216 |
| 216 #endif // SYNC_UTIL_CRYPTOGRAPHER_H_ | 217 #endif // SYNC_UTIL_CRYPTOGRAPHER_H_ |
| OLD | NEW |