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_CORE_SYNC_ENCRYPTION_HANDLER_H_ | 5 #ifndef COMPONENTS_SYNC_CORE_SYNC_ENCRYPTION_HANDLER_H_ |
6 #define COMPONENTS_SYNC_CORE_SYNC_ENCRYPTION_HANDLER_H_ | 6 #define COMPONENTS_SYNC_CORE_SYNC_ENCRYPTION_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "components/sync/base/model_type.h" | 11 #include "components/sync/base/model_type.h" |
12 #include "components/sync/protocol/sync.pb.h" | 12 #include "components/sync/protocol/sync.pb.h" |
13 | 13 |
14 namespace syncer { | 14 namespace syncer { |
15 | 15 |
16 class Cryptographer; | 16 class Cryptographer; |
| 17 enum class PassphraseType; |
17 | 18 |
18 // Reasons due to which Cryptographer might require a passphrase. | 19 // Reasons due to which Cryptographer might require a passphrase. |
19 enum PassphraseRequiredReason { | 20 enum PassphraseRequiredReason { |
20 REASON_PASSPHRASE_NOT_REQUIRED = 0, // Initial value. | 21 REASON_PASSPHRASE_NOT_REQUIRED = 0, // Initial value. |
21 REASON_ENCRYPTION = 1, // The cryptographer requires a | 22 REASON_ENCRYPTION = 1, // The cryptographer requires a |
22 // passphrase for its first attempt at | 23 // passphrase for its first attempt at |
23 // encryption. Happens only during | 24 // encryption. Happens only during |
24 // migration or upgrade. | 25 // migration or upgrade. |
25 REASON_DECRYPTION = 2, // The cryptographer requires a | 26 REASON_DECRYPTION = 2, // The cryptographer requires a |
26 // passphrase for its first attempt at | 27 // passphrase for its first attempt at |
27 // decryption. | 28 // decryption. |
28 }; | 29 }; |
29 | 30 |
30 // The different states for the encryption passphrase. These control if and how | |
31 // the user should be prompted for a decryption passphrase. | |
32 // Do not re-order or delete these entries; they are used in a UMA histogram. | |
33 // Please edit SyncPassphraseType in histograms.xml if a value is added. | |
34 enum class PassphraseType { | |
35 IMPLICIT_PASSPHRASE = 0, // GAIA-based passphrase (deprecated). | |
36 KEYSTORE_PASSPHRASE = 1, // Keystore passphrase. | |
37 FROZEN_IMPLICIT_PASSPHRASE = 2, // Frozen GAIA passphrase. | |
38 CUSTOM_PASSPHRASE = 3, // User-provided passphrase. | |
39 PASSPHRASE_TYPE_SIZE, // The size of this enum; keep last. | |
40 }; | |
41 | |
42 // Enum used to distinguish which bootstrap encryption token is being updated. | 31 // Enum used to distinguish which bootstrap encryption token is being updated. |
43 enum BootstrapTokenType { | 32 enum BootstrapTokenType { |
44 PASSPHRASE_BOOTSTRAP_TOKEN, | 33 PASSPHRASE_BOOTSTRAP_TOKEN, |
45 KEYSTORE_BOOTSTRAP_TOKEN | 34 KEYSTORE_BOOTSTRAP_TOKEN |
46 }; | 35 }; |
47 | 36 |
48 // Sync's encryption handler. Handles tracking encrypted types, ensuring the | 37 // Sync's encryption handler. Handles tracking encrypted types, ensuring the |
49 // cryptographer encrypts with the proper key and has the most recent keybag, | 38 // cryptographer encrypts with the proper key and has the most recent keybag, |
50 // and keeps the nigori node up to date. | 39 // and keeps the nigori node up to date. |
51 // Implementations of this class must be assumed to be non-thread-safe. All | 40 // Implementations of this class must be assumed to be non-thread-safe. All |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // bag of encryption keys in the nigori node. | 170 // bag of encryption keys in the nigori node. |
182 virtual PassphraseType GetPassphraseType() const = 0; | 171 virtual PassphraseType GetPassphraseType() const = 0; |
183 | 172 |
184 // The set of types that are always encrypted. | 173 // The set of types that are always encrypted. |
185 static ModelTypeSet SensitiveTypes(); | 174 static ModelTypeSet SensitiveTypes(); |
186 }; | 175 }; |
187 | 176 |
188 } // namespace syncer | 177 } // namespace syncer |
189 | 178 |
190 #endif // COMPONENTS_SYNC_CORE_SYNC_ENCRYPTION_HANDLER_H_ | 179 #endif // COMPONENTS_SYNC_CORE_SYNC_ENCRYPTION_HANDLER_H_ |
OLD | NEW |