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