Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: components/sync/base/cryptographer.h

Issue 2240613002: [Sync] Convert sync to a static library. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Try getting rid of sync_core source set. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/sync/base/cancelation_signal.h ('k') | components/sync/base/extensions_activity.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/linked_ptr.h" 13 #include "base/memory/linked_ptr.h"
14 #include "components/sync/base/nigori.h" 14 #include "components/sync/base/nigori.h"
15 #include "components/sync/base/sync_export.h"
16 #include "components/sync/protocol/encryption.pb.h" 15 #include "components/sync/protocol/encryption.pb.h"
17 16
18 namespace sync_pb { 17 namespace sync_pb {
19 class NigoriKeyBag; 18 class NigoriKeyBag;
20 class NigoriSpecifics; 19 class NigoriSpecifics;
21 } 20 }
22 21
23 namespace syncer { 22 namespace syncer {
24 23
25 class Encryptor; 24 class Encryptor;
26 25
27 SYNC_EXPORT extern const char kNigoriTag[]; 26 extern const char kNigoriTag[];
28 27
29 // The parameters used to initialize a Nigori instance. 28 // The parameters used to initialize a Nigori instance.
30 struct KeyParams { 29 struct KeyParams {
31 std::string hostname; 30 std::string hostname;
32 std::string username; 31 std::string username;
33 std::string password; 32 std::string password;
34 }; 33 };
35 34
36 // This class manages the Nigori objects used to encrypt and decrypt sensitive 35 // This class manages the Nigori objects used to encrypt and decrypt sensitive
37 // sync data (eg. passwords). Each Nigori object knows how to handle data 36 // sync data (eg. passwords). Each Nigori object knows how to handle data
38 // protected with a particular passphrase. 37 // protected with a particular passphrase.
39 // 38 //
40 // Whenever an update to the Nigori sync node is received from the server, 39 // Whenever an update to the Nigori sync node is received from the server,
41 // SetPendingKeys should be called with the encrypted contents of that node. 40 // SetPendingKeys should be called with the encrypted contents of that node.
42 // Most likely, an updated Nigori node means that a new passphrase has been set 41 // Most likely, an updated Nigori node means that a new passphrase has been set
43 // and that future node updates won't be decryptable. To remedy this, the user 42 // and that future node updates won't be decryptable. To remedy this, the user
44 // should be prompted for the new passphrase and DecryptPendingKeys be called. 43 // should be prompted for the new passphrase and DecryptPendingKeys be called.
45 // 44 //
46 // Whenever a update to an encrypted node is received from the server, 45 // Whenever a update to an encrypted node is received from the server,
47 // CanDecrypt should be used to verify whether the Cryptographer can decrypt 46 // CanDecrypt should be used to verify whether the Cryptographer can decrypt
48 // that node. If it cannot, then the application of that update should be 47 // that node. If it cannot, then the application of that update should be
49 // delayed until after it can be decrypted. 48 // delayed until after it can be decrypted.
50 class SYNC_EXPORT Cryptographer { 49 class Cryptographer {
51 public: 50 public:
52 // Does not take ownership of |encryptor|. 51 // Does not take ownership of |encryptor|.
53 explicit Cryptographer(Encryptor* encryptor); 52 explicit Cryptographer(Encryptor* encryptor);
54 explicit Cryptographer(const Cryptographer& other); 53 explicit Cryptographer(const Cryptographer& other);
55 ~Cryptographer(); 54 ~Cryptographer();
56 55
57 // |restored_bootstrap_token| can be provided via this method to bootstrap 56 // |restored_bootstrap_token| can be provided via this method to bootstrap
58 // Cryptographer instance into the ready state (is_ready will be true). 57 // Cryptographer instance into the ready state (is_ready will be true).
59 // It must be a string that was previously built by the 58 // It must be a string that was previously built by the
60 // GetSerializedBootstrapToken function. It is possible that the token is no 59 // GetSerializedBootstrapToken function. It is possible that the token is no
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 std::string default_nigori_name_; 210 std::string default_nigori_name_;
212 211
213 std::unique_ptr<sync_pb::EncryptedData> pending_keys_; 212 std::unique_ptr<sync_pb::EncryptedData> pending_keys_;
214 213
215 DISALLOW_ASSIGN(Cryptographer); 214 DISALLOW_ASSIGN(Cryptographer);
216 }; 215 };
217 216
218 } // namespace syncer 217 } // namespace syncer
219 218
220 #endif // COMPONENTS_SYNC_BASE_CRYPTOGRAPHER_H_ 219 #endif // COMPONENTS_SYNC_BASE_CRYPTOGRAPHER_H_
OLDNEW
« no previous file with comments | « components/sync/base/cancelation_signal.h ('k') | components/sync/base/extensions_activity.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698