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

Unified Diff: chrome/browser/sync/util/cryptographer.h

Issue 8759019: [Sync] Add intelligent re-encryption support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/util/cryptographer.h
diff --git a/chrome/browser/sync/util/cryptographer.h b/chrome/browser/sync/util/cryptographer.h
index 992c443900b17b1236bf4813cadac76cd9511fa3..f205a81eecfe07428a286061bb9b231e73e789e0 100644
--- a/chrome/browser/sync/util/cryptographer.h
+++ b/chrome/browser/sync/util/cryptographer.h
@@ -103,7 +103,16 @@ class Cryptographer {
// key.
bool CanDecryptUsingDefaultKey(const sync_pb::EncryptedData& encrypted) const;
- // Encrypts |message| into |encrypted|. Returns true unless encryption fails.
+ // Same as Encrypt(..), except exits early and returns true if |message|
+ // matches the decrypted data within |encrypted| and |encrypted| was encrypted
+ // with the current default key. This avoids unnecessarily modifying
+ // |encrypted| if the change had no practical effect.
+ bool EncryptIfDifferent(const ::google::protobuf::MessageLite& message,
+ sync_pb::EncryptedData* encrypted) const;
+
+ // Encrypts |message| into |encrypted|, irregardless of what was previously
akalin 2011/12/09 23:52:42 irregardless -> regardless ( see http://en.wikipe
Nicolas Zea 2011/12/12 20:12:26 Done.
+ // in |encrypted| (as opposed to EncryptIfDifferent). Returns true unless
+ // encryption fails.
// Note that encryption will fail if |message| isn't valid (eg. a required
// field isn't set).
bool Encrypt(const ::google::protobuf::MessageLite& message,
@@ -190,6 +199,10 @@ class Cryptographer {
FRIEND_TEST_ALL_PREFIXES(CryptographerTest, PackUnpack);
typedef std::map<std::string, linked_ptr<const Nigori> > NigoriMap;
+ bool EncryptImpl(const std::string& serialized,
+ const NigoriMap::value_type* nigori,
+ sync_pb::EncryptedData* encrypted) const;
+
// Merges the given set of encrypted types with the existing set and emits a
// notification if necessary.
void MergeEncryptedTypes(const syncable::ModelTypeSet& encrypted_types);

Powered by Google App Engine
This is Rietveld 408576698