| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/extensions/api/networking_private/networking_private_cr
ypto.h" | 5 #include "chrome/browser/extensions/api/networking_private/networking_private_cr
ypto.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "components/cast_certificate/cast_cert_validator.h" | 13 #include "components/cast_certificate/cast_cert_validator.h" |
| 14 #include "crypto/openssl_util.h" | 14 #include "crypto/openssl_util.h" |
| 15 #include "crypto/rsa_private_key.h" | 15 #include "crypto/rsa_private_key.h" |
| 16 #include "net/cert/pem_tokenizer.h" | 16 #include "net/cert/pem_tokenizer.h" |
| 17 #include "third_party/boringssl/src/include/openssl/digest.h" | |
| 18 #include "third_party/boringssl/src/include/openssl/evp.h" | 17 #include "third_party/boringssl/src/include/openssl/evp.h" |
| 19 #include "third_party/boringssl/src/include/openssl/rsa.h" | 18 #include "third_party/boringssl/src/include/openssl/rsa.h" |
| 20 #include "third_party/boringssl/src/include/openssl/x509.h" | |
| 21 | 19 |
| 22 namespace { | 20 namespace { |
| 23 | 21 |
| 24 namespace cast_crypto = ::cast_certificate; | 22 namespace cast_crypto = ::cast_certificate; |
| 25 | 23 |
| 26 // Parses |pem_data| for a PEM block of |pem_type|. | 24 // Parses |pem_data| for a PEM block of |pem_type|. |
| 27 // Returns true if a |pem_type| block is found, storing the decoded result in | 25 // Returns true if a |pem_type| block is found, storing the decoded result in |
| 28 // |der_output|. | 26 // |der_output|. |
| 29 bool GetDERFromPEM(const std::string& pem_data, | 27 bool GetDERFromPEM(const std::string& pem_data, |
| 30 const std::string& pem_type, | 28 const std::string& pem_type, |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 rsa, RSA_PKCS1_PADDING); | 176 rsa, RSA_PKCS1_PADDING); |
| 179 if (output_length < 0) { | 177 if (output_length < 0) { |
| 180 LOG(ERROR) << "Error during decryption."; | 178 LOG(ERROR) << "Error during decryption."; |
| 181 return false; | 179 return false; |
| 182 } | 180 } |
| 183 decrypted_output->resize(output_length); | 181 decrypted_output->resize(output_length); |
| 184 return true; | 182 return true; |
| 185 } | 183 } |
| 186 | 184 |
| 187 } // namespace networking_private_crypto | 185 } // namespace networking_private_crypto |
| OLD | NEW |