OLD | NEW |
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 // Various utility methods for nigori-based multi-type encryption. | 5 // Various utility methods for nigori-based multi-type encryption. |
6 | 6 |
7 #ifndef SYNC_SYNCABLE_NIGORI_UTIL_H_ | 7 #ifndef SYNC_SYNCABLE_NIGORI_UTIL_H_ |
8 #define SYNC_SYNCABLE_NIGORI_UTIL_H_ | 8 #define SYNC_SYNCABLE_NIGORI_UTIL_H_ |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 bool is_encrypted) WARN_UNUSED_RESULT; | 61 bool is_encrypted) WARN_UNUSED_RESULT; |
62 | 62 |
63 // Stores |new_specifics| into |entry|, encrypting if necessary. | 63 // Stores |new_specifics| into |entry|, encrypting if necessary. |
64 // Returns false if an error encrypting occurred (does not modify |entry|). | 64 // Returns false if an error encrypting occurred (does not modify |entry|). |
65 // Note: gracefully handles new_specifics aliasing with entry->Get(SPECIFICS). | 65 // Note: gracefully handles new_specifics aliasing with entry->Get(SPECIFICS). |
66 bool UpdateEntryWithEncryption( | 66 bool UpdateEntryWithEncryption( |
67 Cryptographer* cryptographer, | 67 Cryptographer* cryptographer, |
68 const sync_pb::EntitySpecifics& new_specifics, | 68 const sync_pb::EntitySpecifics& new_specifics, |
69 MutableEntry* entry); | 69 MutableEntry* entry); |
70 | 70 |
| 71 // Updates |nigori| to match the encryption state specified by |encrypted_types| |
| 72 // and |encrypt_everything|. |
| 73 void UpdateNigoriFromEncryptedTypes(ModelTypeSet encrypted_types, |
| 74 bool encrypt_everything, |
| 75 sync_pb::NigoriSpecifics* nigori); |
| 76 |
| 77 // Extracts the set of encrypted types from a nigori node. |
| 78 ModelTypeSet GetEncryptedTypesFromNigori( |
| 79 const sync_pb::NigoriSpecifics& nigori); |
| 80 |
71 } // namespace syncable | 81 } // namespace syncable |
72 } // namespace syncer | 82 } // namespace syncer |
73 | 83 |
74 #endif // SYNC_SYNCABLE_NIGORI_UTIL_H_ | 84 #endif // SYNC_SYNCABLE_NIGORI_UTIL_H_ |
OLD | NEW |