| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "net/cert/internal/cert_errors.h" | 5 #include "net/cert/internal/cert_errors.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 std::string result; | 164 std::string result; |
| 165 | 165 |
| 166 for (size_t i = 0; i < cert_errors_.size(); ++i) { | 166 for (size_t i = 0; i < cert_errors_.size(); ++i) { |
| 167 // Pretty print the current CertErrors. If there were no errors/warnings, | 167 // Pretty print the current CertErrors. If there were no errors/warnings, |
| 168 // then continue. | 168 // then continue. |
| 169 const CertErrors& errors = cert_errors_[i]; | 169 const CertErrors& errors = cert_errors_[i]; |
| 170 std::string cert_errors_string = errors.ToDebugString(); | 170 std::string cert_errors_string = errors.ToDebugString(); |
| 171 if (cert_errors_string.empty()) | 171 if (cert_errors_string.empty()) |
| 172 continue; | 172 continue; |
| 173 | 173 |
| 174 // Add a header for the CertErrors that describes which certificate they | 174 // Add a header that identifies which certificate this CertErrors pertains |
| 175 // apply to. | 175 // to. |
| 176 // | |
| 177 // TODO(eroman): Show the subject for trust anchor (which currently uses the | |
| 178 // bucket cert_errors_[certs.size()]). | |
| 179 std::string cert_name_debug_str; | 176 std::string cert_name_debug_str; |
| 180 if (i < certs.size() && certs[i]) { | 177 if (i < certs.size() && certs[i]) { |
| 181 RDNSequence subject; | 178 RDNSequence subject; |
| 182 if (ParseName(certs[i]->tbs().subject_tlv, &subject) && | 179 if (ParseName(certs[i]->tbs().subject_tlv, &subject) && |
| 183 ConvertToRFC2253(subject, &cert_name_debug_str)) { | 180 ConvertToRFC2253(subject, &cert_name_debug_str)) { |
| 184 cert_name_debug_str = " (" + cert_name_debug_str + ")"; | 181 cert_name_debug_str = " (" + cert_name_debug_str + ")"; |
| 185 } | 182 } |
| 186 } | 183 } |
| 187 | 184 |
| 188 result += | 185 result += |
| (...skipping 10 matching lines...) Expand all Loading... |
| 199 if (!other_errors.empty()) { | 196 if (!other_errors.empty()) { |
| 200 result += "----- Other errors (not certificate specific) -----\n"; | 197 result += "----- Other errors (not certificate specific) -----\n"; |
| 201 result += other_errors; | 198 result += other_errors; |
| 202 result += "\n"; | 199 result += "\n"; |
| 203 } | 200 } |
| 204 | 201 |
| 205 return result; | 202 return result; |
| 206 } | 203 } |
| 207 | 204 |
| 208 } // namespace net | 205 } // namespace net |
| OLD | NEW |