| 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) |
| 11 // Forward declaration. | 11 // Forward declaration. |
| 12 struct SECKEYPrivateKeyStr; | 12 struct SECKEYPrivateKeyStr; |
| 13 struct SECKEYPublicKeyStr; | 13 struct SECKEYPublicKeyStr; |
| 14 #elif defined(OS_MACOSX) | 14 #elif defined(OS_MACOSX) |
| 15 #include <Security/cssm.h> | 15 #include <Security/cssm.h> |
| 16 #elif defined(OS_WIN) | 16 #elif defined(OS_WIN) |
| 17 #include <windows.h> | 17 #include <windows.h> |
| 18 #include <wincrypt.h> | 18 #include <wincrypt.h> |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 #include <list> | 21 #include <list> |
| 22 #include <vector> | 22 #include <vector> |
| 23 | 23 |
| 24 #include "base/basictypes.h" | 24 #include "base/basictypes.h" |
| 25 | 25 |
| 26 #if defined(OS_WIN) |
| 27 #include "base/crypto/scoped_capi_types.h" |
| 28 #endif |
| 29 |
| 26 namespace base { | 30 namespace base { |
| 27 | 31 |
| 28 // Used internally by RSAPrivateKey for serializing and deserializing | 32 // Used internally by RSAPrivateKey for serializing and deserializing |
| 29 // PKCS #8 PrivateKeyInfo and PublicKeyInfo. | 33 // PKCS #8 PrivateKeyInfo and PublicKeyInfo. |
| 30 class PrivateKeyInfoCodec { | 34 class PrivateKeyInfoCodec { |
| 31 public: | 35 public: |
| 32 | 36 |
| 33 // ASN.1 encoding of the AlgorithmIdentifier from PKCS #8. | 37 // ASN.1 encoding of the AlgorithmIdentifier from PKCS #8. |
| 34 static const uint8 kRsaAlgorithmIdentifier[]; | 38 static const uint8 kRsaAlgorithmIdentifier[]; |
| 35 | 39 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 // Constructor is private. Use Create() or CreateFromPrivateKeyInfo() | 191 // Constructor is private. Use Create() or CreateFromPrivateKeyInfo() |
| 188 // instead. | 192 // instead. |
| 189 RSAPrivateKey(); | 193 RSAPrivateKey(); |
| 190 | 194 |
| 191 #if defined(USE_NSS) | 195 #if defined(USE_NSS) |
| 192 SECKEYPrivateKeyStr* key_; | 196 SECKEYPrivateKeyStr* key_; |
| 193 SECKEYPublicKeyStr* public_key_; | 197 SECKEYPublicKeyStr* public_key_; |
| 194 #elif defined(OS_WIN) | 198 #elif defined(OS_WIN) |
| 195 bool InitProvider(); | 199 bool InitProvider(); |
| 196 | 200 |
| 197 HCRYPTPROV provider_; | 201 ScopedHCRYPTPROV provider_; |
| 198 HCRYPTKEY key_; | 202 ScopedHCRYPTKEY key_; |
| 199 #elif defined(OS_MACOSX) | 203 #elif defined(OS_MACOSX) |
| 200 CSSM_KEY key_; | 204 CSSM_KEY key_; |
| 201 #endif | 205 #endif |
| 202 | 206 |
| 203 DISALLOW_COPY_AND_ASSIGN(RSAPrivateKey); | 207 DISALLOW_COPY_AND_ASSIGN(RSAPrivateKey); |
| 204 }; | 208 }; |
| 205 | 209 |
| 206 } // namespace base | 210 } // namespace base |
| 207 | 211 |
| 208 #endif // BASE_CRYPTO_RSA_PRIVATE_KEY_H_ | 212 #endif // BASE_CRYPTO_RSA_PRIVATE_KEY_H_ |
| OLD | NEW |