From 6d6f2034c50dd574c36547527b707753ebe196e3 Mon Sep 17 00:00:00 2001 From: "zea@chromium.org" Date: Thu, 17 Feb 2011 19:36:38 +0000 Subject: Revert 75287 - [Sync] Initial support for encrypting any datatype (no UI hookup yet). BUG=59242 TEST=unit,sync_unit,sync_integration Review URL: http://codereview.chromium.org/6465005 TBR=zea@chromium.org Review URL: http://codereview.chromium.org/6537027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75297 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/sync/util/cryptographer.cc | 13 ++++--------- chrome/browser/sync/util/cryptographer.h | 4 ---- 2 files changed, 4 insertions(+), 13 deletions(-) (limited to 'chrome/browser/sync/util') diff --git a/chrome/browser/sync/util/cryptographer.cc b/chrome/browser/sync/util/cryptographer.cc index da94681..747b094 100644 --- a/chrome/browser/sync/util/cryptographer.cc +++ b/chrome/browser/sync/util/cryptographer.cc @@ -59,24 +59,19 @@ bool Cryptographer::Encrypt(const ::google::protobuf::MessageLite& message, bool Cryptographer::Decrypt(const sync_pb::EncryptedData& encrypted, ::google::protobuf::MessageLite* message) const { DCHECK(message); - std::string plaintext = DecryptToString(encrypted); - return message->ParseFromString(plaintext); -} -std::string Cryptographer::DecryptToString( - const sync_pb::EncryptedData& encrypted) const { NigoriMap::const_iterator it = nigoris_.find(encrypted.key_name()); if (nigoris_.end() == it) { NOTREACHED() << "Cannot decrypt message"; - return std::string(""); // Caller should have called CanDecrypt(encrypt). + return false; // Caller should have called CanDecrypt(encrypt). } std::string plaintext; if (!it->second->Decrypt(encrypted.blob(), &plaintext)) { - return std::string(""); + return false; } - return plaintext; + return message->ParseFromString(plaintext); } bool Cryptographer::GetKeys(sync_pb::EncryptedData* encrypted) const { @@ -209,7 +204,7 @@ Nigori* Cryptographer::UnpackBootstrapToken(const std::string& token) const { return NULL; std::string encrypted_data; - if (!base::Base64Decode(token, &encrypted_data)) { + if (!base::Base64Decode(token, &encrypted_data)){ DLOG(WARNING) << "Could not decode token."; return NULL; } diff --git a/chrome/browser/sync/util/cryptographer.h b/chrome/browser/sync/util/cryptographer.h index adb809b..ada084cc 100644 --- a/chrome/browser/sync/util/cryptographer.h +++ b/chrome/browser/sync/util/cryptographer.h @@ -71,10 +71,6 @@ class Cryptographer { bool Decrypt(const sync_pb::EncryptedData& encrypted, ::google::protobuf::MessageLite* message) const; - // Decrypts |encrypted| and returns plaintext decrypted data. If decryption - // fails, returns empty string. - std::string DecryptToString(const sync_pb::EncryptedData& encrypted) const; - // Encrypts the set of currently known keys into |encrypted|. Returns true if // successful. bool GetKeys(sync_pb::EncryptedData* encrypted) const; -- cgit v1.1