| 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..9b166efebd43c43c6bb30671aa0794a10e440ee8 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 {
|
|
|