| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 CRYPTO_RSA_PRIVATE_KEY_H_ | 5 #ifndef CRYPTO_RSA_PRIVATE_KEY_H_ |
| 6 #define CRYPTO_RSA_PRIVATE_KEY_H_ | 6 #define 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_OPENSSL) | 10 #if defined(USE_OPENSSL) |
| 11 // Forward declaration for openssl/*.h | 11 // Forward declaration for openssl/*.h |
| 12 typedef struct evp_pkey_st EVP_PKEY; | 12 typedef struct evp_pkey_st EVP_PKEY; |
| 13 #elif defined(USE_NSS) | 13 #elif defined(USE_NSS) |
| 14 // Forward declaration. | 14 // Forward declaration. |
| 15 struct SECKEYPrivateKeyStr; | 15 struct SECKEYPrivateKeyStr; |
| 16 struct SECKEYPublicKeyStr; | 16 struct SECKEYPublicKeyStr; |
| 17 #elif defined(OS_IOS) |
| 18 #include <Security/Security.h> |
| 17 #elif defined(OS_MACOSX) | 19 #elif defined(OS_MACOSX) |
| 18 #include <Security/cssm.h> | 20 #include <Security/cssm.h> |
| 19 #endif | 21 #endif |
| 20 | 22 |
| 21 #include <list> | 23 #include <list> |
| 22 #include <vector> | 24 #include <vector> |
| 23 | 25 |
| 24 #include "base/basictypes.h" | 26 #include "base/basictypes.h" |
| 25 #include "crypto/crypto_export.h" | 27 #include "crypto/crypto_export.h" |
| 26 | 28 |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 const std::vector<uint8>& input); | 212 const std::vector<uint8>& input); |
| 211 | 213 |
| 212 #if defined(USE_OPENSSL) | 214 #if defined(USE_OPENSSL) |
| 213 EVP_PKEY* key() { return key_; } | 215 EVP_PKEY* key() { return key_; } |
| 214 #elif defined(USE_NSS) | 216 #elif defined(USE_NSS) |
| 215 SECKEYPrivateKeyStr* key() { return key_; } | 217 SECKEYPrivateKeyStr* key() { return key_; } |
| 216 SECKEYPublicKeyStr* public_key() { return public_key_; } | 218 SECKEYPublicKeyStr* public_key() { return public_key_; } |
| 217 #elif defined(OS_WIN) | 219 #elif defined(OS_WIN) |
| 218 HCRYPTPROV provider() { return provider_; } | 220 HCRYPTPROV provider() { return provider_; } |
| 219 HCRYPTKEY key() { return key_; } | 221 HCRYPTKEY key() { return key_; } |
| 222 #elif defined(OS_IOS) |
| 223 SecKeyRef key() { return key_; } |
| 224 SecKeyRef public_key() { return public_key_; } |
| 220 #elif defined(OS_MACOSX) | 225 #elif defined(OS_MACOSX) |
| 221 CSSM_KEY_PTR key() { return &key_; } | 226 CSSM_KEY_PTR key() { return &key_; } |
| 222 CSSM_KEY_PTR public_key() { return &public_key_; } | 227 CSSM_KEY_PTR public_key() { return &public_key_; } |
| 223 #endif | 228 #endif |
| 224 | 229 |
| 225 // Creates a copy of the object. | 230 // Creates a copy of the object. |
| 226 RSAPrivateKey* Copy() const; | 231 RSAPrivateKey* Copy() const; |
| 227 | 232 |
| 228 // Exports the private key to a PKCS #1 PrivateKey block. | 233 // Exports the private key to a PKCS #1 PrivateKey block. |
| 229 bool ExportPrivateKey(std::vector<uint8>* output) const; | 234 bool ExportPrivateKey(std::vector<uint8>* output) const; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 256 #if defined(USE_OPENSSL) | 261 #if defined(USE_OPENSSL) |
| 257 EVP_PKEY* key_; | 262 EVP_PKEY* key_; |
| 258 #elif defined(USE_NSS) | 263 #elif defined(USE_NSS) |
| 259 SECKEYPrivateKeyStr* key_; | 264 SECKEYPrivateKeyStr* key_; |
| 260 SECKEYPublicKeyStr* public_key_; | 265 SECKEYPublicKeyStr* public_key_; |
| 261 #elif defined(OS_WIN) | 266 #elif defined(OS_WIN) |
| 262 bool InitProvider(); | 267 bool InitProvider(); |
| 263 | 268 |
| 264 ScopedHCRYPTPROV provider_; | 269 ScopedHCRYPTPROV provider_; |
| 265 ScopedHCRYPTKEY key_; | 270 ScopedHCRYPTKEY key_; |
| 271 #elif defined(OS_IOS) |
| 272 SecKeyRef key_; |
| 273 SecKeyRef public_key_; |
| 266 #elif defined(OS_MACOSX) | 274 #elif defined(OS_MACOSX) |
| 267 CSSM_KEY key_; | 275 CSSM_KEY key_; |
| 268 CSSM_KEY public_key_; | 276 CSSM_KEY public_key_; |
| 269 #endif | 277 #endif |
| 270 | 278 |
| 271 DISALLOW_COPY_AND_ASSIGN(RSAPrivateKey); | 279 DISALLOW_COPY_AND_ASSIGN(RSAPrivateKey); |
| 272 }; | 280 }; |
| 273 | 281 |
| 274 } // namespace crypto | 282 } // namespace crypto |
| 275 | 283 |
| 276 #endif // CRYPTO_RSA_PRIVATE_KEY_H_ | 284 #endif // CRYPTO_RSA_PRIVATE_KEY_H_ |
| OLD | NEW |