Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Side by Side Diff: content/browser/devtools/protocol/network_handler.cc

Issue 2191243002: [DevTools] Fix text representation of IP addresses in SAN certificates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change cast type Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "content/browser/devtools/protocol/network_handler.h" 5 #include "content/browser/devtools/protocol/network_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 309
310 std::string name(cert->subject().GetDisplayName()); 310 std::string name(cert->subject().GetDisplayName());
311 std::string issuer(cert->issuer().GetDisplayName()); 311 std::string issuer(cert->issuer().GetDisplayName());
312 base::Time valid_from = cert->valid_start(); 312 base::Time valid_from = cert->valid_start();
313 base::Time valid_to = cert->valid_expiry(); 313 base::Time valid_to = cert->valid_expiry();
314 314
315 std::vector<std::string> dns_names; 315 std::vector<std::string> dns_names;
316 std::vector<std::string> ip_addrs; 316 std::vector<std::string> ip_addrs;
317 cert->GetSubjectAltName(&dns_names, &ip_addrs); 317 cert->GetSubjectAltName(&dns_names, &ip_addrs);
318 318
319 // IP addresses are in raw network bytes and must be converted to string form
320 std::vector<std::string> ip_addrs_string;
321 for (const std::string& ip : ip_addrs) {
322 net::IPAddress ip_addr(reinterpret_cast<const uint8_t*>(ip.c_str()),
323 ip.length());
324 ip_addrs_string.push_back(ip_addr.ToString());
325 }
326
319 *result = CertificateDetails::Create() 327 *result = CertificateDetails::Create()
320 ->set_subject(CertificateSubject::Create() 328 ->set_subject(CertificateSubject::Create()
321 ->set_name(name) 329 ->set_name(name)
322 ->set_san_dns_names(dns_names) 330 ->set_san_dns_names(dns_names)
323 ->set_san_ip_addresses(ip_addrs)) 331 ->set_san_ip_addresses(ip_addrs_string))
324 ->set_issuer(issuer) 332 ->set_issuer(issuer)
325 ->set_valid_from(valid_from.ToDoubleT()) 333 ->set_valid_from(valid_from.ToDoubleT())
326 ->set_valid_to(valid_to.ToDoubleT()); 334 ->set_valid_to(valid_to.ToDoubleT());
327 return Response::OK(); 335 return Response::OK();
328 } 336 }
329 337
330 Response NetworkHandler::ShowCertificateViewer(int certificate_id) { 338 Response NetworkHandler::ShowCertificateViewer(int certificate_id) {
331 if (!host_) 339 if (!host_)
332 return Response::InternalError("Could not connect to view"); 340 return Response::InternalError("Could not connect to view");
333 WebContents* web_contents = WebContents::FromRenderFrameHost(host_); 341 WebContents* web_contents = WebContents::FromRenderFrameHost(host_);
334 web_contents->GetDelegate()->ShowCertificateViewerInDevTools( 342 web_contents->GetDelegate()->ShowCertificateViewerInDevTools(
335 web_contents, certificate_id); 343 web_contents, certificate_id);
336 return Response::OK(); 344 return Response::OK();
337 } 345 }
338 346
339 } // namespace network 347 } // namespace network
340 } // namespace devtools 348 } // namespace devtools
341 } // namespace content 349 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698