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

Side by Side Diff: chrome/browser/sync/util/cryptographer.h

Issue 6537027: Revert 75287 - [Sync] Initial support for encrypting any datatype (no UI hook... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/syncable/syncable.cc ('k') | chrome/browser/sync/util/cryptographer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_SYNC_UTIL_CRYPTOGRAPHER_H_ 5 #ifndef CHROME_BROWSER_SYNC_UTIL_CRYPTOGRAPHER_H_
6 #define CHROME_BROWSER_SYNC_UTIL_CRYPTOGRAPHER_H_ 6 #define CHROME_BROWSER_SYNC_UTIL_CRYPTOGRAPHER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // Note that encryption will fail if |message| isn't valid (eg. a required 64 // Note that encryption will fail if |message| isn't valid (eg. a required
65 // field isn't set). 65 // field isn't set).
66 bool Encrypt(const ::google::protobuf::MessageLite& message, 66 bool Encrypt(const ::google::protobuf::MessageLite& message,
67 sync_pb::EncryptedData* encrypted) const; 67 sync_pb::EncryptedData* encrypted) const;
68 68
69 // Decrypts |encrypted| into |message|. Returns true unless decryption fails, 69 // Decrypts |encrypted| into |message|. Returns true unless decryption fails,
70 // or |message| fails to parse the decrypted data. 70 // or |message| fails to parse the decrypted data.
71 bool Decrypt(const sync_pb::EncryptedData& encrypted, 71 bool Decrypt(const sync_pb::EncryptedData& encrypted,
72 ::google::protobuf::MessageLite* message) const; 72 ::google::protobuf::MessageLite* message) const;
73 73
74 // Decrypts |encrypted| and returns plaintext decrypted data. If decryption
75 // fails, returns empty string.
76 std::string DecryptToString(const sync_pb::EncryptedData& encrypted) const;
77
78 // Encrypts the set of currently known keys into |encrypted|. Returns true if 74 // Encrypts the set of currently known keys into |encrypted|. Returns true if
79 // successful. 75 // successful.
80 bool GetKeys(sync_pb::EncryptedData* encrypted) const; 76 bool GetKeys(sync_pb::EncryptedData* encrypted) const;
81 77
82 // Creates a new Nigori instance using |params|. If successful, |params| will 78 // Creates a new Nigori instance using |params|. If successful, |params| will
83 // become the default encryption key and be used for all future calls to 79 // become the default encryption key and be used for all future calls to
84 // Encrypt. 80 // Encrypt.
85 bool AddKey(const KeyParams& params); 81 bool AddKey(const KeyParams& params);
86 82
87 // Decrypts |encrypted| and uses its contents to initialize Nigori instances. 83 // Decrypts |encrypted| and uses its contents to initialize Nigori instances.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 NigoriMap::value_type* default_nigori_; // The Nigori used for encryption. 127 NigoriMap::value_type* default_nigori_; // The Nigori used for encryption.
132 128
133 scoped_ptr<sync_pb::EncryptedData> pending_keys_; 129 scoped_ptr<sync_pb::EncryptedData> pending_keys_;
134 130
135 DISALLOW_COPY_AND_ASSIGN(Cryptographer); 131 DISALLOW_COPY_AND_ASSIGN(Cryptographer);
136 }; 132 };
137 133
138 } // namespace browser_sync 134 } // namespace browser_sync
139 135
140 #endif // CHROME_BROWSER_SYNC_UTIL_CRYPTOGRAPHER_H_ 136 #endif // CHROME_BROWSER_SYNC_UTIL_CRYPTOGRAPHER_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/syncable/syncable.cc ('k') | chrome/browser/sync/util/cryptographer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698