| 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 #include "crypto/rsa_private_key.h" | 5 #include "crypto/rsa_private_key.h" |
| 6 | 6 |
| 7 #include <openssl/bio.h> | |
| 8 #include <openssl/bn.h> | |
| 9 #include <openssl/evp.h> | |
| 10 #include <openssl/pkcs12.h> | |
| 11 #include <openssl/rsa.h> | |
| 12 | |
| 13 #include "base/logging.h" | 7 #include "base/logging.h" |
| 14 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 15 #include "crypto/openssl_util.h" | 9 #include "crypto/openssl_util.h" |
| 16 #include "crypto/scoped_openssl_types.h" | 10 #include "crypto/scoped_openssl_types.h" |
| 11 #include "third_party/boringssl/src/include/openssl/bio.h" |
| 12 #include "third_party/boringssl/src/include/openssl/bn.h" |
| 13 #include "third_party/boringssl/src/include/openssl/evp.h" |
| 14 #include "third_party/boringssl/src/include/openssl/pkcs12.h" |
| 15 #include "third_party/boringssl/src/include/openssl/rsa.h" |
| 17 | 16 |
| 18 namespace crypto { | 17 namespace crypto { |
| 19 | 18 |
| 20 namespace { | 19 namespace { |
| 21 | 20 |
| 22 using ScopedPKCS8_PRIV_KEY_INFO = | 21 using ScopedPKCS8_PRIV_KEY_INFO = |
| 23 ScopedOpenSSL<PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO_free>; | 22 ScopedOpenSSL<PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO_free>; |
| 24 | 23 |
| 25 // Function pointer definition, for injecting the required key export function | 24 // Function pointer definition, for injecting the required key export function |
| 26 // into ExportKey, below. The supplied function should export EVP_PKEY into | 25 // into ExportKey, below. The supplied function should export EVP_PKEY into |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 128 |
| 130 bool RSAPrivateKey::ExportPrivateKey(std::vector<uint8>* output) const { | 129 bool RSAPrivateKey::ExportPrivateKey(std::vector<uint8>* output) const { |
| 131 return ExportKey(key_, i2d_PKCS8PrivateKeyInfo_bio, output); | 130 return ExportKey(key_, i2d_PKCS8PrivateKeyInfo_bio, output); |
| 132 } | 131 } |
| 133 | 132 |
| 134 bool RSAPrivateKey::ExportPublicKey(std::vector<uint8>* output) const { | 133 bool RSAPrivateKey::ExportPublicKey(std::vector<uint8>* output) const { |
| 135 return ExportKey(key_, i2d_PUBKEY_bio, output); | 134 return ExportKey(key_, i2d_PUBKEY_bio, output); |
| 136 } | 135 } |
| 137 | 136 |
| 138 } // namespace crypto | 137 } // namespace crypto |
| OLD | NEW |