| OLD | NEW |
| 1 // Copyright 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 COMPONENTS_SYNC_BASE_NIGORI_H_ | 5 #ifndef COMPONENTS_SYNC_BASE_NIGORI_H_ |
| 6 #define COMPONENTS_SYNC_BASE_NIGORI_H_ | 6 #define COMPONENTS_SYNC_BASE_NIGORI_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "components/sync/base/sync_export.h" | |
| 14 | |
| 15 namespace crypto { | 13 namespace crypto { |
| 16 class SymmetricKey; | 14 class SymmetricKey; |
| 17 } // namespace crypto | 15 } // namespace crypto |
| 18 | 16 |
| 19 namespace syncer { | 17 namespace syncer { |
| 20 | 18 |
| 21 // 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 |
| 22 // the cloud. This implementation does not support server authentication or | 20 // the cloud. This implementation does not support server authentication or |
| 23 // assisted key derivation. | 21 // assisted key derivation. |
| 24 // | 22 // |
| 25 // 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 |
| 26 // 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 |
| 27 // and retrieve the secret. | 25 // and retrieve the secret. |
| 28 // | 26 // |
| 29 // https://www.cl.cam.ac.uk/~drt24/nigori/nigori-overview.pdf | 27 // https://www.cl.cam.ac.uk/~drt24/nigori/nigori-overview.pdf |
| 30 class SYNC_EXPORT Nigori { | 28 class Nigori { |
| 31 public: | 29 public: |
| 32 enum Type { | 30 enum Type { |
| 33 Password = 1, | 31 Password = 1, |
| 34 }; | 32 }; |
| 35 | 33 |
| 36 Nigori(); | 34 Nigori(); |
| 37 virtual ~Nigori(); | 35 virtual ~Nigori(); |
| 38 | 36 |
| 39 // Initialize the client with the given |hostname|, |username| and |password|. | 37 // Initialize the client with the given |hostname|, |username| and |password|. |
| 40 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... |
| 79 | 77 |
| 80 private: | 78 private: |
| 81 std::unique_ptr<crypto::SymmetricKey> user_key_; | 79 std::unique_ptr<crypto::SymmetricKey> user_key_; |
| 82 std::unique_ptr<crypto::SymmetricKey> encryption_key_; | 80 std::unique_ptr<crypto::SymmetricKey> encryption_key_; |
| 83 std::unique_ptr<crypto::SymmetricKey> mac_key_; | 81 std::unique_ptr<crypto::SymmetricKey> mac_key_; |
| 84 }; | 82 }; |
| 85 | 83 |
| 86 } // namespace syncer | 84 } // namespace syncer |
| 87 | 85 |
| 88 #endif // COMPONENTS_SYNC_BASE_NIGORI_H_ | 86 #endif // COMPONENTS_SYNC_BASE_NIGORI_H_ |
| OLD | NEW |