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 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 SECKEYPrivateKeyStr* key() { return key_; } | 216 SECKEYPrivateKeyStr* key() { return key_; } |
217 SECKEYPublicKeyStr* public_key() { return public_key_; } | 217 SECKEYPublicKeyStr* public_key() { return public_key_; } |
218 #elif defined(OS_WIN) | 218 #elif defined(OS_WIN) |
219 HCRYPTPROV provider() { return provider_; } | 219 HCRYPTPROV provider() { return provider_; } |
220 HCRYPTKEY key() { return key_; } | 220 HCRYPTKEY key() { return key_; } |
221 #elif defined(OS_MACOSX) | 221 #elif defined(OS_MACOSX) |
222 CSSM_KEY_PTR key() { return &key_; } | 222 CSSM_KEY_PTR key() { return &key_; } |
223 CSSM_KEY_PTR public_key() { return &public_key_; } | 223 CSSM_KEY_PTR public_key() { return &public_key_; } |
224 #endif | 224 #endif |
225 | 225 |
| 226 // Creates a copy of the object. |
| 227 RSAPrivateKey* Copy() const; |
| 228 |
226 // Exports the private key to a PKCS #1 PrivateKey block. | 229 // Exports the private key to a PKCS #1 PrivateKey block. |
227 bool ExportPrivateKey(std::vector<uint8>* output); | 230 bool ExportPrivateKey(std::vector<uint8>* output); |
228 | 231 |
229 // Exports the public key to an X509 SubjectPublicKeyInfo block. | 232 // Exports the public key to an X509 SubjectPublicKeyInfo block. |
230 bool ExportPublicKey(std::vector<uint8>* output); | 233 bool ExportPublicKey(std::vector<uint8>* output); |
231 | 234 |
232 private: | 235 private: |
233 #if defined(USE_NSS) | 236 #if defined(USE_NSS) |
234 FRIEND_TEST_ALL_PREFIXES(RSAPrivateKeyNSSTest, FindFromPublicKey); | 237 FRIEND_TEST_ALL_PREFIXES(RSAPrivateKeyNSSTest, FindFromPublicKey); |
235 FRIEND_TEST_ALL_PREFIXES(RSAPrivateKeyNSSTest, FailedFindFromPublicKey); | 238 FRIEND_TEST_ALL_PREFIXES(RSAPrivateKeyNSSTest, FailedFindFromPublicKey); |
(...skipping 29 matching lines...) Expand all Loading... |
265 CSSM_KEY key_; | 268 CSSM_KEY key_; |
266 CSSM_KEY public_key_; | 269 CSSM_KEY public_key_; |
267 #endif | 270 #endif |
268 | 271 |
269 DISALLOW_COPY_AND_ASSIGN(RSAPrivateKey); | 272 DISALLOW_COPY_AND_ASSIGN(RSAPrivateKey); |
270 }; | 273 }; |
271 | 274 |
272 } // namespace crypto | 275 } // namespace crypto |
273 | 276 |
274 #endif // CRYPTO_RSA_PRIVATE_KEY_H_ | 277 #endif // CRYPTO_RSA_PRIVATE_KEY_H_ |
OLD | NEW |