-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.html
118 lines (108 loc) · 5.94 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<script src="https://unpkg.com/@peculiar/x509"></script>
<script src="static/js/x509.js"></script>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;700&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="static/styles.css" />
</head>
<body>
<div class="wrapper">
<img src="static/images/logo.svg" alt="Logo" width="220" height="191" />
<h1 class="mainTitle">Print Your Certificate</h1>
<div class="divider"></div>
<div>
<h2 class="secondaryTitle">Display your Certificate</h2>
<div class="panel">
<div class="content" id="content">
<label>Subject</label>
<div id="placeholder-subject"></div>
<label>Subject Alternative Names</label>
<div id="placeholder-sans"></div>
<label>Issuer</label>
<div id="placeholder-issuer"></div>
<label>Serial</label>
<div id="placeholder-serial"></div>
<label>Public key algorithm</label>
<div id="placeholder-algorithm"></div>
<label>Not before</label>
<div id="placeholder-not-before"></div>
<label>Not after</label>
<div id="placeholder-not-after"></div>
<label>Certificate PEM</label>
<div>
<pre id="placeholder-pem"></pre>
</div>
</div>
</div>
</div>
<a id="placeholder-download-pem">Download <code>client.crt</code></a>
<a id="placeholder-download-pem-key">Download <code>client.key</code></a>
<p>This URL will be kept alive as long as GitHub Pages is alive.</p>
<div class="push"></div>
</div>
<footer>
<p>
Powered by
<a href="https://cert-manager.io" target="_blank">cert-manager.io</a>
</p>
<p class="small">
Project proudly supported by
<a href="https://venafi.com" target="_blank">Venafi</a>
</p>
<p class="small">
Design by
<a href="https://constantinchirila.com" target="_blank"
>Constantin Chirila</a
>
</p>
</footer>
<script>
try {
const cert = getAsn1();
document.getElementById("placeholder-subject").innerHTML = cert.subject;
cert.extensions.forEach((extension) => {
if (extension.type === "2.5.29.17") {
document.getElementById("placeholder-sans").innerHTML = extension.names.items;
}
});
document.getElementById("placeholder-issuer").innerHTML = cert.issuer;
document.getElementById("placeholder-serial").innerHTML =
cert.serialNumber;
document.getElementById("placeholder-algorithm").innerHTML =
cert.signatureAlgorithm.name;
document.getElementById("placeholder-not-before").innerHTML =
cert.notBefore;
document.getElementById("placeholder-not-after").innerHTML =
cert.notAfter;
document.getElementById("placeholder-pem").innerHTML = cert;
const blobcert = new Blob([cert], { type: 'application/octet-stream' });
const downloadCertLink = document.getElementById("placeholder-download-pem");
downloadCertLink.href = URL.createObjectURL(blobcert);
downloadCertLink.download = 'client.crt';
var key = params.key || params.k; // Example: "MIIDBzCCAe%2Bg...GLMQswCQYD%0A"
if (!key) {
console.log("the query parameter 'k' or 'key' was not passed, skipping");
} else {
const blobkey = new Blob([`-----BEGIN PRIVATE KEY-----\n${key}\n-----END PRIVATE KEY-----`], { type: 'application/octet-stream' });
const downloadKeyLink = document.getElementById("placeholder-download-pem-key");
downloadKeyLink.href = URL.createObjectURL(blobkey);
downloadKeyLink.download = 'client.key';
}
} catch (e) {
document.getElementById("content").innerHTML =
"Issue with the certificate: " + e;
}
</script>
</body>
</html>
<!--
Old example: https://cert-manager.github.io/print-your-cert/?asn1=MIICXDCCAgOgAwIBAgIQdPaTuGSUDeosii4dbdLBgTAKBggqhkjOPQQDAjAnMSUwIwYDVQQDExxUaGUgY2VydC1tYW5hZ2VyIG1haW50YWluZXJzMB4XDTIyMDUxNjEzMDkwMFoXDTIyMDgxNDEzMDkwMFowLDEqMCgGA1UEAwwhZm9vIGJhciBmb28gYmF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