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

Unified Diff: components/sync/base/nigori.h

Issue 2813453004: [sync] Fix decryption failure caused by missing user_key (Closed)
Patch Set: [sync] Fix decryption failure caused by missing user_key Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: components/sync/base/nigori.h
diff --git a/components/sync/base/nigori.h b/components/sync/base/nigori.h
index d0088c38ec13852649fdbb2107f2e227d8aac111..fe22f852f234adcf09f025ef0188ddb71815f796 100644
--- a/components/sync/base/nigori.h
+++ b/components/sync/base/nigori.h
@@ -41,7 +41,8 @@ class Nigori {
// Initialize the client by importing the given keys instead of deriving new
// ones.
- bool InitByImport(const std::string& encryption_key,
+ bool InitByImport(const std::string& user_key,
+ const std::string& encryption_key,
const std::string& mac_key);
// Derives a secure lookup name from |type| and |name|. If |hostname|,
@@ -59,7 +60,9 @@ class Nigori {
bool Decrypt(const std::string& value, std::string* decrypted) const;
// Exports the raw derived keys.
- bool ExportKeys(std::string* encryption_key, std::string* mac_key) const;
+ bool ExportKeys(std::string* user_key,
+ std::string* encryption_key,
+ std::string* mac_key) const;
static const char kSaltSalt[]; // The salt used to derive the user salt.
static const size_t kSaltKeySizeInBits = 128;
@@ -68,10 +71,12 @@ class Nigori {
static const size_t kHashSize = 32;
static const size_t kSaltIterations = 1001;
+ static const size_t kUserIterations = 1002;
static const size_t kEncryptionIterations = 1003;
static const size_t kSigningIterations = 1004;
private:
+ std::unique_ptr<crypto::SymmetricKey> user_key_;
std::unique_ptr<crypto::SymmetricKey> encryption_key_;
std::unique_ptr<crypto::SymmetricKey> mac_key_;
};

Powered by Google App Engine
This is Rietveld 408576698