OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 SYNC_UTIL_NIGORI_H_ | 5 #ifndef SYNC_UTIL_NIGORI_H_ |
6 #define SYNC_UTIL_NIGORI_H_ | 6 #define SYNC_UTIL_NIGORI_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "sync/base/sync_export.h" |
11 | 12 |
12 namespace crypto { | 13 namespace crypto { |
13 class SymmetricKey; | 14 class SymmetricKey; |
14 } // namespace crypto | 15 } // namespace crypto |
15 | 16 |
16 namespace syncer { | 17 namespace syncer { |
17 | 18 |
18 // A (partial) implementation of Nigori, a protocol to securely store secrets in | 19 // A (partial) implementation of Nigori, a protocol to securely store secrets in |
19 // the cloud. This implementation does not support server authentication or | 20 // the cloud. This implementation does not support server authentication or |
20 // assisted key derivation. | 21 // assisted key derivation. |
21 // | 22 // |
22 // To store secrets securely, use the |Permute| method to derive a lookup name | 23 // To store secrets securely, use the |Permute| method to derive a lookup name |
23 // for your secret (basically a map key), and |Encrypt| and |Decrypt| to store | 24 // for your secret (basically a map key), and |Encrypt| and |Decrypt| to store |
24 // and retrieve the secret. | 25 // and retrieve the secret. |
25 // | 26 // |
26 // TODO: Link to doc. | 27 // TODO: Link to doc. |
27 class Nigori { | 28 class SYNC_EXPORT Nigori { |
28 public: | 29 public: |
29 enum Type { | 30 enum Type { |
30 Password = 1, | 31 Password = 1, |
31 }; | 32 }; |
32 | 33 |
33 Nigori(); | 34 Nigori(); |
34 virtual ~Nigori(); | 35 virtual ~Nigori(); |
35 | 36 |
36 // Initialize the client with the given |hostname|, |username| and |password|. | 37 // Initialize the client with the given |hostname|, |username| and |password|. |
37 bool InitByDerivation(const std::string& hostname, | 38 bool InitByDerivation(const std::string& hostname, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 77 |
77 private: | 78 private: |
78 scoped_ptr<crypto::SymmetricKey> user_key_; | 79 scoped_ptr<crypto::SymmetricKey> user_key_; |
79 scoped_ptr<crypto::SymmetricKey> encryption_key_; | 80 scoped_ptr<crypto::SymmetricKey> encryption_key_; |
80 scoped_ptr<crypto::SymmetricKey> mac_key_; | 81 scoped_ptr<crypto::SymmetricKey> mac_key_; |
81 }; | 82 }; |
82 | 83 |
83 } // namespace syncer | 84 } // namespace syncer |
84 | 85 |
85 #endif // SYNC_UTIL_NIGORI_H_ | 86 #endif // SYNC_UTIL_NIGORI_H_ |
OLD | NEW |