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

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

Issue 6465005: [Sync] Initial support for encrypting any datatype (no UI hookup yet). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + small fix 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
74 // Encrypts the set of currently known keys into |encrypted|. Returns true if 78 // Encrypts the set of currently known keys into |encrypted|. Returns true if
75 // successful. 79 // successful.
76 bool GetKeys(sync_pb::EncryptedData* encrypted) const; 80 bool GetKeys(sync_pb::EncryptedData* encrypted) const;
77 81
78 // Creates a new Nigori instance using |params|. If successful, |params| will 82 // Creates a new Nigori instance using |params|. If successful, |params| will
79 // become the default encryption key and be used for all future calls to 83 // become the default encryption key and be used for all future calls to
80 // Encrypt. 84 // Encrypt.
81 bool AddKey(const KeyParams& params); 85 bool AddKey(const KeyParams& params);
82 86
83 // Decrypts |encrypted| and uses its contents to initialize Nigori instances. 87 // Decrypts |encrypted| and uses its contents to initialize Nigori instances.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 NigoriMap::value_type* default_nigori_; // The Nigori used for encryption. 131 NigoriMap::value_type* default_nigori_; // The Nigori used for encryption.
128 132
129 scoped_ptr<sync_pb::EncryptedData> pending_keys_; 133 scoped_ptr<sync_pb::EncryptedData> pending_keys_;
130 134
131 DISALLOW_COPY_AND_ASSIGN(Cryptographer); 135 DISALLOW_COPY_AND_ASSIGN(Cryptographer);
132 }; 136 };
133 137
134 } // namespace browser_sync 138 } // namespace browser_sync
135 139
136 #endif // CHROME_BROWSER_SYNC_UTIL_CRYPTOGRAPHER_H_ 140 #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