OLD | NEW |
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_NIGORI_H_ | 5 #ifndef CHROME_BROWSER_SYNC_UTIL_NIGORI_H_ |
6 #define CHROME_BROWSER_SYNC_UTIL_NIGORI_H_ | 6 #define CHROME_BROWSER_SYNC_UTIL_NIGORI_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/crypto/symmetric_key.h" | 10 #include "base/crypto/symmetric_key.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 // Encrypts |value|. Note that on success, |encrypted| will be Base64 | 44 // Encrypts |value|. Note that on success, |encrypted| will be Base64 |
45 // encoded. | 45 // encoded. |
46 bool Encrypt(const std::string& value, std::string* encrypted); | 46 bool Encrypt(const std::string& value, std::string* encrypted); |
47 | 47 |
48 // Decrypts |value| into |decrypted|. It is assumed that |value| is Base64 | 48 // Decrypts |value| into |decrypted|. It is assumed that |value| is Base64 |
49 // encoded. | 49 // encoded. |
50 bool Decrypt(const std::string& value, std::string* decrypted); | 50 bool Decrypt(const std::string& value, std::string* decrypted); |
51 | 51 |
52 static const char kSaltSalt[]; // The salt used to derive the user salt. | 52 static const char kSaltSalt[]; // The salt used to derive the user salt. |
53 static const size_t kSaltKeySizeInBits = 64; | 53 static const size_t kSaltKeySizeInBits = 128; |
54 static const size_t kDerivedKeySizeInBits = 128; | 54 static const size_t kDerivedKeySizeInBits = 128; |
55 static const size_t kIvSize = 16; | 55 static const size_t kIvSize = 16; |
56 static const size_t kHashSize = 32; | 56 static const size_t kHashSize = 32; |
57 | 57 |
58 static const size_t kSaltIterations = 1001; | 58 static const size_t kSaltIterations = 1001; |
59 static const size_t kUserIterations = 1002; | 59 static const size_t kUserIterations = 1002; |
60 static const size_t kEncryptionIterations = 1003; | 60 static const size_t kEncryptionIterations = 1003; |
61 static const size_t kSigningIterations = 1004; | 61 static const size_t kSigningIterations = 1004; |
62 | 62 |
63 private: | 63 private: |
64 const std::string hostname_; | 64 const std::string hostname_; |
65 scoped_ptr<base::SymmetricKey> user_key_; | 65 scoped_ptr<base::SymmetricKey> user_key_; |
66 scoped_ptr<base::SymmetricKey> encryption_key_; | 66 scoped_ptr<base::SymmetricKey> encryption_key_; |
67 scoped_ptr<base::SymmetricKey> mac_key_; | 67 scoped_ptr<base::SymmetricKey> mac_key_; |
68 }; | 68 }; |
69 | 69 |
70 } // namespace browser_sync | 70 } // namespace browser_sync |
71 | 71 |
72 #endif // CHROME_BROWSER_SYNC_UTIL_NIGORI_H_ | 72 #endif // CHROME_BROWSER_SYNC_UTIL_NIGORI_H_ |
OLD | NEW |