MCPcopy Create free account
hub / github.com/adobe/Marinus / display_certificate

Function display_certificate

web_server/public/javascripts/certs.js:571–593  ·  view source on GitHub ↗
(results, req_type)

Source from the content-addressed store, hash-verified

569}
570
571function display_certificate(results, req_type) {
572 var displayHTML = "";
573 if (req_type === "ct_id" || req_type === "ct_sha1" || req_type === "ct_sha256") {
574 displayHTML = '<a href="/api/v1.0/ct/download/' + results['_id'] + '">Click to download the DER file</a><br/>';
575 displayHTML += '<div class="bg-light"><pre>' + results['full_certificate'] + "</pre></div><br/>";
576 } else if (req_type === "censys_sha1" || req_type === "censys_sha256") {
577 let cert_string = JSON.stringify(results[0]['p443']['https']['tls']['certificate']['parsed'], null, 2);
578 displayHTML += '<div class="bg-light"><pre>' + cert_string + "</pre></div><br/>";
579 } else {
580 let tls_log;
581 if (Object.hasOwn(results[0]['data']['http']['response']['request'], 'tls_log')) {
582 // ZGrab 2.0
583 tls_log = results[0]['data']['http']['response']['request']['tls_log']['handshake_log'];
584 } else {
585 // ZGrab
586 tls_log = results[0]['data']['http']['response']['request']['tls_handshake'];
587 }
588 let cert_string = JSON.stringify(tls_log['server_certificates']['certificate']['parsed'], null, 2);
589 displayHTML += '<div class="bg-light"><pre>' + cert_string + "</pre></div><br/>";
590 }
591
592 document.getElementById("cert_info").innerHTML = displayHTML;
593}
594
595function fetch_certificate() {
596 var id = qs("id");

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected