OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CRYPTO_SYMMETRIC_KEY_H_ | 5 #ifndef CRYPTO_SYMMETRIC_KEY_H_ |
6 #define CRYPTO_SYMMETRIC_KEY_H_ | 6 #define CRYPTO_SYMMETRIC_KEY_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 PK11SymKey* key() const { return key_.get(); } | 63 PK11SymKey* key() const { return key_.get(); } |
64 #elif defined(OS_MACOSX) | 64 #elif defined(OS_MACOSX) |
65 CSSM_DATA cssm_data() const; | 65 CSSM_DATA cssm_data() const; |
66 #elif defined(OS_WIN) | 66 #elif defined(OS_WIN) |
67 HCRYPTKEY key() const { return key_.get(); } | 67 HCRYPTKEY key() const { return key_.get(); } |
68 #endif | 68 #endif |
69 | 69 |
70 // Extracts the raw key from the platform specific data. | 70 // Extracts the raw key from the platform specific data. |
71 // Warning: |raw_key| holds the raw key as bytes and thus must be handled | 71 // Warning: |raw_key| holds the raw key as bytes and thus must be handled |
72 // carefully. | 72 // carefully. |
73 bool GetRawKey(std::string* raw_key); | 73 bool GetRawKey(std::string* raw_key) const; |
Ryan Sleevi
2012/01/04 01:33:43
This isn't a const operation on Windows, at least
Greg Spencer (Chromium)
2012/01/05 22:18:03
Crap. OK, I'll change the constness of the argume
| |
74 | 74 |
75 #if defined(OS_CHROMEOS) | 75 #if defined(OS_CHROMEOS) |
76 // Creates symmetric key from NSS key. Takes over the ownership of |key|. | 76 // Creates symmetric key from NSS key. Takes over the ownership of |key|. |
77 static SymmetricKey* CreateFromKey(PK11SymKey* key); | 77 static SymmetricKey* CreateFromKey(PK11SymKey* key); |
78 #endif | 78 #endif |
79 | 79 |
80 private: | 80 private: |
81 #if defined(USE_OPENSSL) | 81 #if defined(USE_OPENSSL) |
82 SymmetricKey() {} | 82 SymmetricKey() {} |
83 std::string key_; | 83 std::string key_; |
(...skipping 18 matching lines...) Expand all Loading... | |
102 // fails with NTE_BAD_KEY/NTE_BAD_LEN | 102 // fails with NTE_BAD_KEY/NTE_BAD_LEN |
103 std::string raw_key_; | 103 std::string raw_key_; |
104 #endif | 104 #endif |
105 | 105 |
106 DISALLOW_COPY_AND_ASSIGN(SymmetricKey); | 106 DISALLOW_COPY_AND_ASSIGN(SymmetricKey); |
107 }; | 107 }; |
108 | 108 |
109 } // namespace crypto | 109 } // namespace crypto |
110 | 110 |
111 #endif // CRYPTO_SYMMETRIC_KEY_H_ | 111 #endif // CRYPTO_SYMMETRIC_KEY_H_ |
OLD | NEW |