| 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 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 #if defined(USE_OPENSSL) | 208 #if defined(USE_OPENSSL) |
| 209 EVP_PKEY* key() { return key_; } | 209 EVP_PKEY* key() { return key_; } |
| 210 #elif defined(USE_NSS) | 210 #elif defined(USE_NSS) |
| 211 SECKEYPrivateKeyStr* key() { return key_; } | 211 SECKEYPrivateKeyStr* key() { return key_; } |
| 212 SECKEYPublicKeyStr* public_key() { return public_key_; } | 212 SECKEYPublicKeyStr* public_key() { return public_key_; } |
| 213 #elif defined(OS_WIN) | 213 #elif defined(OS_WIN) |
| 214 HCRYPTPROV provider() { return provider_; } | 214 HCRYPTPROV provider() { return provider_; } |
| 215 HCRYPTKEY key() { return key_; } | 215 HCRYPTKEY key() { return key_; } |
| 216 #elif defined(OS_MACOSX) | 216 #elif defined(OS_MACOSX) |
| 217 CSSM_KEY_PTR key() { return &key_; } | 217 CSSM_KEY_PTR key() { return &key_; } |
| 218 CSSM_KEY_PTR public_key() { return &public_key_; } |
| 218 #endif | 219 #endif |
| 219 | 220 |
| 220 // Exports the private key to a PKCS #1 PrivateKey block. | 221 // Exports the private key to a PKCS #1 PrivateKey block. |
| 221 bool ExportPrivateKey(std::vector<uint8>* output); | 222 bool ExportPrivateKey(std::vector<uint8>* output); |
| 222 | 223 |
| 223 // Exports the public key to an X509 SubjectPublicKeyInfo block. | 224 // Exports the public key to an X509 SubjectPublicKeyInfo block. |
| 224 bool ExportPublicKey(std::vector<uint8>* output); | 225 bool ExportPublicKey(std::vector<uint8>* output); |
| 225 | 226 |
| 226 private: | 227 private: |
| 227 #if defined(USE_NSS) | 228 #if defined(USE_NSS) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 250 #elif defined(USE_NSS) | 251 #elif defined(USE_NSS) |
| 251 SECKEYPrivateKeyStr* key_; | 252 SECKEYPrivateKeyStr* key_; |
| 252 SECKEYPublicKeyStr* public_key_; | 253 SECKEYPublicKeyStr* public_key_; |
| 253 #elif defined(OS_WIN) | 254 #elif defined(OS_WIN) |
| 254 bool InitProvider(); | 255 bool InitProvider(); |
| 255 | 256 |
| 256 ScopedHCRYPTPROV provider_; | 257 ScopedHCRYPTPROV provider_; |
| 257 ScopedHCRYPTKEY key_; | 258 ScopedHCRYPTKEY key_; |
| 258 #elif defined(OS_MACOSX) | 259 #elif defined(OS_MACOSX) |
| 259 CSSM_KEY key_; | 260 CSSM_KEY key_; |
| 261 CSSM_KEY public_key_; |
| 260 #endif | 262 #endif |
| 261 | 263 |
| 262 DISALLOW_COPY_AND_ASSIGN(RSAPrivateKey); | 264 DISALLOW_COPY_AND_ASSIGN(RSAPrivateKey); |
| 263 }; | 265 }; |
| 264 | 266 |
| 265 } // namespace base | 267 } // namespace base |
| 266 | 268 |
| 267 #endif // BASE_CRYPTO_RSA_PRIVATE_KEY_H_ | 269 #endif // BASE_CRYPTO_RSA_PRIVATE_KEY_H_ |
| OLD | NEW |