| Index: chrome/browser/sync/util/cryptographer.cc
|
| diff --git a/chrome/browser/sync/util/cryptographer.cc b/chrome/browser/sync/util/cryptographer.cc
|
| index 747b09469995af7be418d12751a0f2d35c156dab..da946812a73475bffa03595acd454fbefdb18ef6 100644
|
| --- a/chrome/browser/sync/util/cryptographer.cc
|
| +++ b/chrome/browser/sync/util/cryptographer.cc
|
| @@ -59,19 +59,24 @@ 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 false; // Caller should have called CanDecrypt(encrypt).
|
| + return std::string(""); // Caller should have called CanDecrypt(encrypt).
|
| }
|
|
|
| std::string plaintext;
|
| if (!it->second->Decrypt(encrypted.blob(), &plaintext)) {
|
| - return false;
|
| + return std::string("");
|
| }
|
|
|
| - return message->ParseFromString(plaintext);
|
| + return plaintext;
|
| }
|
|
|
| bool Cryptographer::GetKeys(sync_pb::EncryptedData* encrypted) const {
|
| @@ -204,7 +209,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;
|
| }
|
|
|