| 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/tools/cert_verify_tool/verify_using_path_builder.h" | 5 #include "net/tools/cert_verify_tool/verify_using_path_builder.h" |
| 6 | 6 |
| 7 #include <iostream> | 7 #include <iostream> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 190 |
| 191 net::TestClosure callback; | 191 net::TestClosure callback; |
| 192 net::CompletionStatus rv = path_builder.Run(callback.closure()); | 192 net::CompletionStatus rv = path_builder.Run(callback.closure()); |
| 193 | 193 |
| 194 if (rv == net::CompletionStatus::ASYNC) { | 194 if (rv == net::CompletionStatus::ASYNC) { |
| 195 DVLOG(1) << "waiting for async completion..."; | 195 DVLOG(1) << "waiting for async completion..."; |
| 196 callback.WaitForResult(); | 196 callback.WaitForResult(); |
| 197 DVLOG(1) << "async completed."; | 197 DVLOG(1) << "async completed."; |
| 198 } | 198 } |
| 199 | 199 |
| 200 // TODO(crbug.com/634443): Display the full error information. |
| 200 std::cout << "CertPathBuilder best result: " | 201 std::cout << "CertPathBuilder best result: " |
| 201 << net::ErrorToShortString(result.error()) << "\n"; | 202 << net::ErrorToShortString(result.error()) << "\n"; |
| 202 | 203 |
| 203 for (size_t i = 0; i < result.paths.size(); ++i) { | 204 for (size_t i = 0; i < result.paths.size(); ++i) { |
| 204 std::cout << "path " << i << " " | 205 std::cout << "path " << i << " " |
| 205 << net::ErrorToShortString(result.paths[i]->error) | 206 << net::ErrorToShortString(result.paths[i]->error) |
| 206 << ((result.best_result_index == i) ? " (best)" : "") << "\n"; | 207 << ((result.best_result_index == i) ? " (best)" : "") << "\n"; |
| 207 for (const auto& cert : result.paths[i]->path.certs) { | 208 for (const auto& cert : result.paths[i]->path.certs) { |
| 208 std::cout << " " << FingerPrintParsedCertificate(cert.get()) << " " | 209 std::cout << " " << FingerPrintParsedCertificate(cert.get()) << " " |
| 209 << SubjectFromParsedCertificate(cert.get()) << "\n"; | 210 << SubjectFromParsedCertificate(cert.get()) << "\n"; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 226 if (!DumpParsedCertificateChain( | 227 if (!DumpParsedCertificateChain( |
| 227 dump_prefix_path.AddExtension( | 228 dump_prefix_path.AddExtension( |
| 228 FILE_PATH_LITERAL(".CertPathBuilder.pem")), | 229 FILE_PATH_LITERAL(".CertPathBuilder.pem")), |
| 229 result.paths[result.best_result_index]->path)) { | 230 result.paths[result.best_result_index]->path)) { |
| 230 return false; | 231 return false; |
| 231 } | 232 } |
| 232 } | 233 } |
| 233 | 234 |
| 234 return result.error() == net::OK; | 235 return result.error() == net::OK; |
| 235 } | 236 } |
| OLD | NEW |