OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Various utility methods for nigori-based multi-type encryption. | 5 // Various utility methods for nigori-based multi-type encryption. |
6 | 6 |
7 #ifndef CHROME_BROWSER_SYNC_ENGINE_NIGORI_UTIL_H_ | 7 #ifndef CHROME_BROWSER_SYNC_ENGINE_NIGORI_UTIL_H_ |
8 #define CHROME_BROWSER_SYNC_ENGINE_NIGORI_UTIL_H_ | 8 #define CHROME_BROWSER_SYNC_ENGINE_NIGORI_UTIL_H_ |
9 #pragma once | 9 #pragma once |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 class WriteTransaction; | 29 class WriteTransaction; |
30 | 30 |
31 // Check if our unsyced changes are encrypted if they need to be based on | 31 // Check if our unsyced changes are encrypted if they need to be based on |
32 // |encrypted_types|. | 32 // |encrypted_types|. |
33 // Returns: true if all unsynced data that should be encrypted is. | 33 // Returns: true if all unsynced data that should be encrypted is. |
34 // false if some unsynced changes need to be encrypted. | 34 // false if some unsynced changes need to be encrypted. |
35 // This method is similar to ProcessUnsyncedChangesForEncryption but does not | 35 // This method is similar to ProcessUnsyncedChangesForEncryption but does not |
36 // modify the data and does not care if data is unnecessarily encrypted. | 36 // modify the data and does not care if data is unnecessarily encrypted. |
37 bool VerifyUnsyncedChangesAreEncrypted( | 37 bool VerifyUnsyncedChangesAreEncrypted( |
38 BaseTransaction* const trans, | 38 BaseTransaction* const trans, |
39 ModelEnumSet encrypted_types); | 39 ModelTypeSet encrypted_types); |
40 | 40 |
41 // Processes all unsynced changes and ensures they are appropriately encrypted | 41 // Processes all unsynced changes and ensures they are appropriately encrypted |
42 // or unencrypted, based on |encrypted_types|. | 42 // or unencrypted, based on |encrypted_types|. |
43 bool ProcessUnsyncedChangesForEncryption( | 43 bool ProcessUnsyncedChangesForEncryption( |
44 WriteTransaction* const trans, | 44 WriteTransaction* const trans, |
45 browser_sync::Cryptographer* cryptographer); | 45 browser_sync::Cryptographer* cryptographer); |
46 | 46 |
47 // Returns true if the entry requires encryption but is not encrypted, false | 47 // Returns true if the entry requires encryption but is not encrypted, false |
48 // otherwise. Note: this does not check that already encrypted entries are | 48 // otherwise. Note: this does not check that already encrypted entries are |
49 // encrypted with the proper key. | 49 // encrypted with the proper key. |
50 bool EntryNeedsEncryption(ModelEnumSet encrypted_types, | 50 bool EntryNeedsEncryption(ModelTypeSet encrypted_types, |
51 const Entry& entry); | 51 const Entry& entry); |
52 | 52 |
53 // Same as EntryNeedsEncryption, but looks at specifics. | 53 // Same as EntryNeedsEncryption, but looks at specifics. |
54 bool SpecificsNeedsEncryption(ModelEnumSet encrypted_types, | 54 bool SpecificsNeedsEncryption(ModelTypeSet encrypted_types, |
55 const sync_pb::EntitySpecifics& specifics); | 55 const sync_pb::EntitySpecifics& specifics); |
56 | 56 |
57 // Verifies all data of type |type| is encrypted appropriately. | 57 // Verifies all data of type |type| is encrypted appropriately. |
58 bool VerifyDataTypeEncryptionForTest( | 58 bool VerifyDataTypeEncryptionForTest( |
59 BaseTransaction* const trans, | 59 BaseTransaction* const trans, |
60 browser_sync::Cryptographer* cryptographer, | 60 browser_sync::Cryptographer* cryptographer, |
61 ModelType type, | 61 ModelType type, |
62 bool is_encrypted) WARN_UNUSED_RESULT; | 62 bool is_encrypted) WARN_UNUSED_RESULT; |
63 | 63 |
64 } // namespace syncable | 64 } // namespace syncable |
65 | 65 |
66 #endif // CHROME_BROWSER_SYNC_ENGINE_NIGORI_UTIL_H_ | 66 #endif // CHROME_BROWSER_SYNC_ENGINE_NIGORI_UTIL_H_ |
OLD | NEW |