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

Side by Side Diff: sync/internal_api/public/sync_encryption_handler.h

Issue 10878015: [Sync] Move keystore key handling to SyncEncryptionHandlerImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_H_ 5 #ifndef SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_H_
6 #define SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_H_ 6 #define SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "sync/internal_api/public/base/model_type.h" 10 #include "sync/internal_api/public/base/model_type.h"
(...skipping 20 matching lines...) Expand all
31 31
32 // The different states for the encryption passphrase. These control if and how 32 // The different states for the encryption passphrase. These control if and how
33 // the user should be prompted for a decryption passphrase. 33 // the user should be prompted for a decryption passphrase.
34 enum PassphraseState { 34 enum PassphraseState {
35 IMPLICIT_PASSPHRASE = 0, // GAIA-based passphrase (deprecated). 35 IMPLICIT_PASSPHRASE = 0, // GAIA-based passphrase (deprecated).
36 KEYSTORE_PASSPHRASE = 1, // Keystore passphrase. 36 KEYSTORE_PASSPHRASE = 1, // Keystore passphrase.
37 FROZEN_IMPLICIT_PASSPHRASE = 2, // Frozen GAIA passphrase. 37 FROZEN_IMPLICIT_PASSPHRASE = 2, // Frozen GAIA passphrase.
38 CUSTOM_PASSPHRASE = 3, // User-provided passphrase. 38 CUSTOM_PASSPHRASE = 3, // User-provided passphrase.
39 }; 39 };
40 40
41 // Enum used to distinguish which bootstrap encryption token is being updated.
42 enum BootstrapTokenType {
43 PASSPHRASE_BOOTSTRAP_TOKEN,
44 KEYSTORE_BOOTSTRAP_TOKEN
45 };
46
41 // Sync's encryption handler. Handles tracking encrypted types, ensuring the 47 // Sync's encryption handler. Handles tracking encrypted types, ensuring the
42 // cryptographer encrypts with the proper key and has the most recent keybag, 48 // cryptographer encrypts with the proper key and has the most recent keybag,
43 // and keeps the nigori node up to date. 49 // and keeps the nigori node up to date.
44 // Implementations of this class must be assumed to be non-thread-safe. All 50 // Implementations of this class must be assumed to be non-thread-safe. All
45 // methods must be invoked on the sync thread. 51 // methods must be invoked on the sync thread.
46 class SyncEncryptionHandler { 52 class SyncEncryptionHandler {
47 public: 53 public:
48 // All Observer methods are done synchronously from within a transaction and 54 // All Observer methods are done synchronously from within a transaction and
49 // on the sync thread. 55 // on the sync thread.
50 class Observer { 56 class Observer {
(...skipping 19 matching lines...) Expand all
70 virtual void OnPassphraseAccepted() = 0; 76 virtual void OnPassphraseAccepted() = 0;
71 // |bootstrap_token| is an opaque base64 encoded representation of the key 77 // |bootstrap_token| is an opaque base64 encoded representation of the key
72 // generated by the current passphrase, and is provided to the observer for 78 // generated by the current passphrase, and is provided to the observer for
73 // persistence purposes and use in a future initialization of sync (e.g. 79 // persistence purposes and use in a future initialization of sync (e.g.
74 // after restart). The boostrap token will always be derived from the most 80 // after restart). The boostrap token will always be derived from the most
75 // recent GAIA password (for accounts with implicit passphrases), even if 81 // recent GAIA password (for accounts with implicit passphrases), even if
76 // the data is still encrypted with an older GAIA password. For accounts 82 // the data is still encrypted with an older GAIA password. For accounts
77 // with explicit passphrases, it will be the most recently seen custom 83 // with explicit passphrases, it will be the most recently seen custom
78 // passphrase. 84 // passphrase.
79 virtual void OnBootstrapTokenUpdated( 85 virtual void OnBootstrapTokenUpdated(
80 const std::string& bootstrap_token) = 0; 86 const std::string& bootstrap_token,
87 BootstrapTokenType type) = 0;
81 88
82 // Called when the set of encrypted types or the encrypt 89 // Called when the set of encrypted types or the encrypt
83 // everything flag has been changed. Note that encryption isn't 90 // everything flag has been changed. Note that encryption isn't
84 // complete until the OnEncryptionComplete() notification has been 91 // complete until the OnEncryptionComplete() notification has been
85 // sent (see below). 92 // sent (see below).
86 // 93 //
87 // |encrypted_types| will always be a superset of 94 // |encrypted_types| will always be a superset of
88 // Cryptographer::SensitiveTypes(). If |encrypt_everything| is 95 // Cryptographer::SensitiveTypes(). If |encrypt_everything| is
89 // true, |encrypted_types| will be the set of all known types. 96 // true, |encrypted_types| will be the set of all known types.
90 // 97 //
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // bag of encryption keys in the nigori node. 162 // bag of encryption keys in the nigori node.
156 virtual PassphraseState GetPassphraseState() const = 0; 163 virtual PassphraseState GetPassphraseState() const = 0;
157 164
158 // The set of types that are always encrypted. 165 // The set of types that are always encrypted.
159 static ModelTypeSet SensitiveTypes(); 166 static ModelTypeSet SensitiveTypes();
160 }; 167 };
161 168
162 } // namespace syncer 169 } // namespace syncer
163 170
164 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_H_ 171 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_H_
OLDNEW
« no previous file with comments | « sync/internal_api/js_sync_encryption_handler_observer_unittest.cc ('k') | sync/internal_api/public/sync_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698