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 "extensions/common/cast/cast_cert_validator.h" | 5 #include "extensions/common/cast/cast_cert_validator.h" |
6 | 6 |
7 #include <openssl/digest.h> | 7 #include <openssl/digest.h> |
8 #include <openssl/evp.h> | 8 #include <openssl/evp.h> |
9 #include <openssl/rsa.h> | 9 #include <openssl/rsa.h> |
10 #include <openssl/x509.h> | 10 #include <openssl/x509.h> |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } | 64 } |
65 | 65 |
66 std::string GetCommonName() const override { | 66 std::string GetCommonName() const override { |
67 int common_name_length = X509_NAME_get_text_by_NID( | 67 int common_name_length = X509_NAME_get_text_by_NID( |
68 x509_->cert_info->subject, NID_commonName, NULL, 0); | 68 x509_->cert_info->subject, NID_commonName, NULL, 0); |
69 if (common_name_length < 0) | 69 if (common_name_length < 0) |
70 return std::string(); | 70 return std::string(); |
71 std::string common_name; | 71 std::string common_name; |
72 common_name_length = X509_NAME_get_text_by_NID( | 72 common_name_length = X509_NAME_get_text_by_NID( |
73 x509_->cert_info->subject, NID_commonName, | 73 x509_->cert_info->subject, NID_commonName, |
74 WriteInto(&common_name, static_cast<size_t>(common_name_length) + 1), | 74 base::WriteInto(&common_name, |
| 75 static_cast<size_t>(common_name_length) + 1), |
75 common_name_length + 1); | 76 common_name_length + 1); |
76 if (common_name_length < 0) | 77 if (common_name_length < 0) |
77 return std::string(); | 78 return std::string(); |
78 return common_name; | 79 return common_name; |
79 } | 80 } |
80 | 81 |
81 private: | 82 private: |
82 net::ScopedX509 x509_; | 83 net::ScopedX509 x509_; |
83 }; | 84 }; |
84 | 85 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 return VerificationResult(); | 149 return VerificationResult(); |
149 } | 150 } |
150 | 151 |
151 std::string VerificationResult::GetLogString() const { | 152 std::string VerificationResult::GetLogString() const { |
152 return error_message; | 153 return error_message; |
153 } | 154 } |
154 | 155 |
155 } // namespace cast_crypto | 156 } // namespace cast_crypto |
156 } // namespace core_api | 157 } // namespace core_api |
157 } // namespace extensions | 158 } // namespace extensions |
OLD | NEW |