OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 BASE_CRYPTO_RSA_PRIVATE_KEY_H_ | 5 #ifndef BASE_CRYPTO_RSA_PRIVATE_KEY_H_ |
6 #define BASE_CRYPTO_RSA_PRIVATE_KEY_H_ | 6 #define BASE_CRYPTO_RSA_PRIVATE_KEY_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #if defined(USE_NSS) | 10 #if defined(USE_NSS) |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 const std::vector<uint8>& input); | 167 const std::vector<uint8>& input); |
168 | 168 |
169 ~RSAPrivateKey(); | 169 ~RSAPrivateKey(); |
170 | 170 |
171 #if defined(USE_NSS) | 171 #if defined(USE_NSS) |
172 SECKEYPrivateKeyStr* key() { return key_; } | 172 SECKEYPrivateKeyStr* key() { return key_; } |
173 #elif defined(OS_WIN) | 173 #elif defined(OS_WIN) |
174 HCRYPTPROV provider() { return provider_; } | 174 HCRYPTPROV provider() { return provider_; } |
175 HCRYPTKEY key() { return key_; } | 175 HCRYPTKEY key() { return key_; } |
176 #elif defined(OS_MACOSX) | 176 #elif defined(OS_MACOSX) |
177 CSSM_CSP_HANDLE csp_handle() { return csp_handle_; } | |
178 CSSM_KEY_PTR key() { return &key_; } | 177 CSSM_KEY_PTR key() { return &key_; } |
179 #endif | 178 #endif |
180 | 179 |
181 // Exports the private key to a PKCS #1 PrivateKey block. | 180 // Exports the private key to a PKCS #1 PrivateKey block. |
182 bool ExportPrivateKey(std::vector<uint8>* output); | 181 bool ExportPrivateKey(std::vector<uint8>* output); |
183 | 182 |
184 // Exports the public key to an X509 SubjectPublicKeyInfo block. | 183 // Exports the public key to an X509 SubjectPublicKeyInfo block. |
185 bool ExportPublicKey(std::vector<uint8>* output); | 184 bool ExportPublicKey(std::vector<uint8>* output); |
186 | 185 |
187 private: | 186 private: |
188 // Constructor is private. Use Create() or CreateFromPrivateKeyInfo() | 187 // Constructor is private. Use Create() or CreateFromPrivateKeyInfo() |
189 // instead. | 188 // instead. |
190 RSAPrivateKey(); | 189 RSAPrivateKey(); |
191 | 190 |
192 #if defined(USE_NSS) | 191 #if defined(USE_NSS) |
193 SECKEYPrivateKeyStr* key_; | 192 SECKEYPrivateKeyStr* key_; |
194 SECKEYPublicKeyStr* public_key_; | 193 SECKEYPublicKeyStr* public_key_; |
195 #elif defined(OS_WIN) | 194 #elif defined(OS_WIN) |
196 bool InitProvider(); | 195 bool InitProvider(); |
197 | 196 |
198 HCRYPTPROV provider_; | 197 HCRYPTPROV provider_; |
199 HCRYPTKEY key_; | 198 HCRYPTKEY key_; |
200 #elif defined(OS_MACOSX) | 199 #elif defined(OS_MACOSX) |
201 CSSM_KEY key_; | 200 CSSM_KEY key_; |
202 CSSM_CSP_HANDLE csp_handle_; | |
203 #endif | 201 #endif |
204 | 202 |
205 DISALLOW_COPY_AND_ASSIGN(RSAPrivateKey); | 203 DISALLOW_COPY_AND_ASSIGN(RSAPrivateKey); |
206 }; | 204 }; |
207 | 205 |
208 } // namespace base | 206 } // namespace base |
209 | 207 |
210 #endif // BASE_CRYPTO_RSA_PRIVATE_KEY_H_ | 208 #endif // BASE_CRYPTO_RSA_PRIVATE_KEY_H_ |
OLD | NEW |