diff options
author | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-17 19:36:38 +0000 |
---|---|---|
committer | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-17 19:36:38 +0000 |
commit | 6d6f2034c50dd574c36547527b707753ebe196e3 (patch) | |
tree | 2e56a9830f36ac2560ac2c9f933d06a4a82f9d8e /chrome/browser/sync/util | |
parent | eeeb25e6a364cd50fe3298486a45cdce5db558c3 (diff) | |
download | chromium_src-6d6f2034c50dd574c36547527b707753ebe196e3.zip chromium_src-6d6f2034c50dd574c36547527b707753ebe196e3.tar.gz chromium_src-6d6f2034c50dd574c36547527b707753ebe196e3.tar.bz2 |
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
Diffstat (limited to 'chrome/browser/sync/util')
-rw-r--r-- | chrome/browser/sync/util/cryptographer.cc | 13 | ||||
-rw-r--r-- | chrome/browser/sync/util/cryptographer.h | 4 |
2 files changed, 4 insertions, 13 deletions
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; |