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 #include <list> | 10 #include <list> |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
209 | 209 |
210 // Import an existing public key, and then search for the private | 210 // Import an existing public key, and then search for the private |
211 // half in the slot specified by |slot|. The format of the public | 211 // half in the slot specified by |slot|. The format of the public |
212 // key blob is is an X509 SubjectPublicKeyInfo block. This can return | 212 // key blob is is an X509 SubjectPublicKeyInfo block. This can return |
213 // NULL if initialization fails or the private key cannot be found. | 213 // NULL if initialization fails or the private key cannot be found. |
214 // The caller takes ownership of the returned object, but nothing new | 214 // The caller takes ownership of the returned object, but nothing new |
215 // is created in the slot. | 215 // is created in the slot. |
216 static RSAPrivateKey* FindFromPublicKeyInfoInSlot( | 216 static RSAPrivateKey* FindFromPublicKeyInfoInSlot( |
217 const std::vector<uint8>& input, | 217 const std::vector<uint8>& input, |
218 PK11SlotInfo* slot); | 218 PK11SlotInfo* slot); |
219 #elif defined(USE_OPENSSL) | |
220 // Create a new instance by referencing an existing private key | |
221 // structure. Does not import the key. | |
davidben
2014/09/09 18:28:57
Nit: What does "Does not import the key" mean in t
dougsteed
2014/09/09 21:05:47
Done.
| |
222 static RSAPrivateKey* CreateFromKey(EVP_PKEY* key); | |
223 | |
219 #endif | 224 #endif |
220 | 225 |
221 #if defined(USE_OPENSSL) | 226 #if defined(USE_OPENSSL) |
222 EVP_PKEY* key() { return key_; } | 227 EVP_PKEY* key() { return key_; } |
223 #else | 228 #else |
224 SECKEYPrivateKey* key() { return key_; } | 229 SECKEYPrivateKey* key() { return key_; } |
225 SECKEYPublicKey* public_key() { return public_key_; } | 230 SECKEYPublicKey* public_key() { return public_key_; } |
226 #endif | 231 #endif |
227 | 232 |
228 // Creates a copy of the object. | 233 // Creates a copy of the object. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
278 SECKEYPrivateKey* key_; | 283 SECKEYPrivateKey* key_; |
279 SECKEYPublicKey* public_key_; | 284 SECKEYPublicKey* public_key_; |
280 #endif | 285 #endif |
281 | 286 |
282 DISALLOW_COPY_AND_ASSIGN(RSAPrivateKey); | 287 DISALLOW_COPY_AND_ASSIGN(RSAPrivateKey); |
283 }; | 288 }; |
284 | 289 |
285 } // namespace crypto | 290 } // namespace crypto |
286 | 291 |
287 #endif // CRYPTO_RSA_PRIVATE_KEY_H_ | 292 #endif // CRYPTO_RSA_PRIVATE_KEY_H_ |
OLD | NEW |