summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemy <relst@relst.nl>2015-02-21 08:37:36 +0100
committerRemy <relst@relst.nl>2015-02-21 08:37:36 +0100
commitddff1c8f5687817939d47faf506538155c578333 (patch)
tree22af38c6dd32ab08cf88ea41c745168415bc9407
parentf66fd749250f8b60ec78fcdd2f50026019836069 (diff)
downloadssl-decoder-ddff1c8f5687817939d47faf506538155c578333.zip
ssl-decoder-ddff1c8f5687817939d47faf506538155c578333.tar.gz
ssl-decoder-ddff1c8f5687817939d47faf506538155c578333.tar.bz2
Add SPKI hash
-rw-r--r--CHANGELOG.md5
-rw-r--r--functions/parse_certificate.php16
-rw-r--r--functions/verify_certifitcate.php10
-rw-r--r--index.php2
4 files changed, 29 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0e41db3..3b94b11 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
# Changelog
+## 1.7
+
+- Split code up in seperate files
+- Add SPKI hash
+
## 1.6
- Remove JSON output
diff --git a/functions/parse_certificate.php b/functions/parse_certificate.php
index ddd4dfa..f13869d 100644
--- a/functions/parse_certificate.php
+++ b/functions/parse_certificate.php
@@ -627,9 +627,10 @@
</div>
<div id="pub-pem-collapse<?php echo bcdechex($cert_data['serialNumber']); ?>" class="panel-collapse collapse" role="tabpanel" aria-labelledby="pub-pem-heading<?php echo bcdechex($cert_data['serialNumber']); ?>">
<div class="panel-body">
- <?php
- echo "<pre>";
- echo htmlspecialchars($key_details['key']);
+
+ <?php
+ echo "<pre>";
+ echo htmlspecialchars($key_details['key']);
?>
</pre>
</div>
@@ -638,6 +639,15 @@
</div>
</td>
</tr>
+ <tr>
+ <td><a href="https://raymii.org/s/articles/HTTP_Public_Key_Pinning_Extension_HPKP.html">SPKI Hash</a></td>
+ <td>
+ <?php
+ $spki_hash = spki_hash($export_pem);
+ print(htmlspecialchars($spki_hash));
+ ?>
+ </td>
+ </tr>
<?php
}
?>
diff --git a/functions/verify_certifitcate.php b/functions/verify_certifitcate.php
index ccb2ac9..802eaf4 100644
--- a/functions/verify_certifitcate.php
+++ b/functions/verify_certifitcate.php
@@ -76,4 +76,14 @@ function cert_signature_algorithm($raw_cert_data) {
return($signature_algorithm);
}
+function spki_hash($raw_cert_data) {
+ global $random_blurp;
+ $tmp_dir = '/tmp/';
+ openssl_x509_export_to_file($raw_cert_data, $tmp_dir.$random_blurp.'.cert_client.pem');
+ $output = shell_exec('openssl x509 -noout -in '.$tmp_dir.$random_blurp.'.cert_client.pem -pubkey | openssl asn1parse -noout -inform pem -out '.$tmp_dir.$random_blurp.'.public.key; openssl dgst -sha256 -binary '. $tmp_dir . $random_blurp . '.public.key | openssl enc -base64 2>&1');
+
+ unlink($tmp_dir.$random_blurp.'.cert_client.pem');
+ return(trim(htmlspecialchars($output)));
+}
+
?> \ No newline at end of file
diff --git a/index.php b/index.php
index 78b9701..797a892 100644
--- a/index.php
+++ b/index.php
@@ -245,7 +245,7 @@ foreach (glob("functions/*.php") as $filename) {
?>
<div class="footer">
<div class="col-md-6 col-md-offset-1 container">
- <p class="text-muted">By <a href="https://raymii.org/s/software/OpenSSL_Decoder.html">Remy van Elst</a>. License: GNU GPLv3. <a href="https://github.com/RaymiiOrg/ssl-decoder">Source code</a>. <strong><a href="https://cipherli.st/">Strong SSL Ciphers & Config settings @ Cipherli.st</a></strong>. Version: 1.6</p>
+ <p class="text-muted">By <a href="https://raymii.org/s/software/OpenSSL_Decoder.html">Remy van Elst</a>. License: GNU GPLv3. <a href="https://github.com/RaymiiOrg/ssl-decoder">Source code</a>. <strong><a href="https://cipherli.st/">Strong SSL Ciphers & Config settings @ Cipherli.st</a></strong>. Version: 1.7</p>
</div>
</div>
<?php