Skip to content

Commit 188a649

Browse files
save file
1 parent 4bf0ee2 commit 188a649

File tree

1 file changed

+91
-91
lines changed

1 file changed

+91
-91
lines changed

utils/x509/extract-public-key/v2.0/extract-public-key-v2.0.html

Lines changed: 91 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<head>
99
<meta charset=utf-8>
10-
10+
1111
<title>
1212
Extract Public Key
1313
</title>
@@ -19,7 +19,7 @@
1919

2020
<link rel=icon type='image/x-icon' href='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAMAAAAM7l6QAAAAz1BMVEVHcExFjOkWsvNGjug9jOxBhesulvAMtfsqofAvoO4pn+8hqPA0j+4WtvQhoPQfuvENuPkYrPchsfMYrPcepfVFiOgqnPE5jO1CguofrfEbrPULufoLu/kIu/sUtfMRsfljr/Q+h+0tl/JmufcJuPwVrfiTz/kZqvcknPNRoPKky/um0vobp/YcpfZmo/NltfY1nvKUxvl7vvdJtPYtqPVDvfms1/o3q/VEku9Ki+09mfFZlfCb1/mfxPu54PmEx/q64/lsw/dTqvOUvflcsvflva1XAAAAH3RSTlMAKFwUi9XO/jUfW1zpJf4KqOcY1+1BrNHsPaPJhNJObHCDBwAAAM1JREFUKM/lkUcSgkAURAEJIyoK5sjA4ICggBJMiPH+Z5IRq3SBxQHs7avf1d2fov5aFZqu/IQ026/XebZaTLuctlssDjoPCm85zV3bsQN1vuie1fwguME49fSeKAIFAGrINJqzRp6K22/O5zVEaeJbltRpd+SRrLZbwvjF6cHxhCIHh9fLxvO87WppzueqKhhGq/nGjxDHUYYRQl94quTmdxtCjBNMzKUMmwQLxuQdzbVteAuikEQTa0QMUfVTzHHwj2Ils5SNWvaSP9QTHZEaQktZsJwAAAAASUVORK5CYII='>
2121
<meta name=viewport content='width=device-width, initial-scale=1'>
22-
22+
2323
<script type='application/ld+json'>
2424
{
2525
"@context" : "https://schema.org",
@@ -35,94 +35,94 @@
3535
"offers" : {"@type":"Offer","price":"0","priceCurrency":"GBP"}
3636
}
3737
</script>
38-
39-
40-
<script src='https://libs.ext-code.com/js/dom/component/component.js'></script>
41-
38+
39+
40+
<script src='https://libs.ext-code.com/js/dom/component/v3.0/component.js'></script>
41+
4242
<script init>
4343
console.clear();
4444
console.log('extract-public-key-v2.0.html');
4545
console.log();
4646
console.json=v=>console.log(JSON.stringify(v,null,4));
4747
var df=true,did='html'
4848
;
49-
49+
5050
var ext;
5151
var $;
5252
var datatype;
5353
var menumod;
5454
var keydown;
55-
55+
5656
var hdr;
5757
var filemod;
5858
var log;
5959

60-
61-
60+
61+
6262

6363
//:
6464

6565

6666
async function init(){
67-
68-
67+
68+
6969
await load();
70-
71-
70+
71+
7272
menu = menumod();
73-
73+
7474
mod.base.add({ext,$,datatype,keydown,menu,menumod});
7575

76-
76+
7777
hdr = mod['x509-hdr'];
7878
//filemod = mod['file-mod'];
7979
log = mod['log-mod'];
80-
81-
80+
81+
8282
hdr.initmod({ext,$,menu});
8383
//filemod.initmod({ext,$,menu,menumod,complete,focus,source,editor,log});
8484
log.initmod({ext,$});
85-
85+
8686
await Promise.all([
8787
hdr.init(),
8888
//filemod.init(),
8989
log.init(),
9090
]);
91-
92-
93-
91+
92+
93+
9494
initdom(document.body);
95-
96-
95+
96+
9797
}//init
98-
99-
98+
99+
100100
(async()=>{
101101

102102
mod.stack.add;
103103

104104
({ext} = await import('https://libs.ext-code.com/js/io/ext-loader/ext-loader.m.js'));
105-
105+
106106
var promise = ext.load.libs(
107107
'js/dom/$.js',
108108
'js/core/datatype.js',
109109
'js/dom/menumod/menumod.js',
110110
'js/dom/keydown/keydown.js',
111111
);
112112
[$,datatype,menumod,keydown] = await promise;
113-
113+
114114
mod.stack.complete;
115-
115+
116116
})();
117117

118118

119119

120-
121-
async function load(){
122120

123-
//var nodeForge = await import('https://cdn.jsdelivr.net/npm/node-forge/+esm');
121+
async function load(){
122+
123+
//var nodeForge = await import('https://cdn.jsdelivr.net/npm/node-forge/+esm');
124124
var txt = localStorage['node-forge'];
125-
125+
126126
if(!txt){
127127
var url = 'https://cdn.jsdelivr.net/npm/node-forge/+esm';
128128
console.log(url);
@@ -137,42 +137,42 @@
137137
pki = nodeforge.default.pki;
138138
console.log(pki);
139139
}//load
140-
141-
140+
141+
142142
</script init>
143143

144-
144+
145145
<style>
146-
146+
147147
html
148148
{height:100%}
149149
body
150150
{height:calc(100% - 42px);margin:20px;display:flex;flex-direction:column;font-family:arial}
151-
151+
152152
x509-hdr
153153
{margin-bottom:20px}
154-
155-
.hdr
154+
155+
.hdr
156156
{font-family:arial;position:relative;margin-top:0;margin-bottom:20px;background:white;
157157
padding-bottom:10px;border-bottom:3px solid lightblue}
158-
.hdr-icon
158+
.hdr-icon
159159
{display:inline-block;text-align:center;background:whitesmoke;border-radius:5px;
160160
border:1px solid lightgray;padding:5px 3px 0px;cursor:pointer;margin-right:10px;
161161
min-width:50px}
162-
.hdr-icon-img
162+
.hdr-icon-img
163163
{width:25px;height:25px}
164-
.hdr-icon-label
164+
.hdr-icon-label
165165
{margin:2px 0 0}
166-
.hdr-title
166+
.hdr-title
167167
{position:absolute;left:0;right:0;z-index:0;margin:0 auto}
168168
.hdr-date
169169
{float:right}
170-
170+
171171
input
172172
{padding:5px 10px;font-size:16px}
173173
input[type=button]
174174
{cursor:pointer}
175-
175+
176176
#view
177177
{flex:1;display:flex;gap:10px}
178178
#cert-root
@@ -185,20 +185,20 @@
185185
{flex:1}
186186
pre
187187
{border:1px solid lightgray;font-size:16px;font-family:monospace}
188-
189-
188+
189+
190190
.visually-hidden
191191
{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;
192192
clip:rect(0 0 0 0) !important;white-space:nowrap !important;border:0 !important}
193-
194-
193+
194+
195195
</style>
196-
196+
197197
</head>
198-
199-
198+
199+
200200
<body>
201-
201+
202202
<x509-hdr component=grp>
203203
<h1 class=visually-hidden>
204204
extract public key
@@ -208,8 +208,8 @@ <h1 class=visually-hidden>
208208
15 Nov 2025
209209
</time>
210210
</x509-hdr>
211-
212-
211+
212+
213213
<!--
214214
<div class=hdr>
215215
<a class=hdr-icon href='https://javascript-2020.github.io/'>
@@ -261,40 +261,40 @@ <h1 class=visually-hidden>
261261
</div>
262262
<pre id=key>
263263
</pre>
264-
264+
265265
</div>
266-
266+
267267
</div>
268-
268+
269269
<log-mod component></log-mod>
270270

271271
</body>
272-
273-
272+
273+
274274
<script>
275-
276-
275+
276+
277277
var pki;
278278

279279
var cert;
280280
var key;
281-
281+
282282

283283
var btn = {};
284284
btn.cert = {};
285285
btn.key = {};
286-
287-
288-
//:
289286

287+
288+
//:
289+
290290
function initdom(){
291-
291+
292292
var rootnode = document.body;
293293

294-
294+
295295
hdr.initdom(rootnode);
296-
297-
296+
297+
298298
var root = {};
299299

300300
root.cert = $(rootnode,'#cert-root');
@@ -312,35 +312,35 @@ <h1 class=visually-hidden>
312312
$(root.key,'[value=save]').onclick = btn.key.save;
313313

314314
key = $(root.key,'#key');
315-
316-
317-
315+
316+
317+
318318
log.initdom();
319319

320320
}//initdom
321-
322-
321+
322+
323323
//:
324324

325325

326326
btn.cert.paste = async function(e){
327-
327+
328328
var txt = await navigator.clipboard.readText();
329329
cert.textContent = txt;
330330

331331
}//paste
332332

333333

334334
btn.cert.load = function(e){
335-
335+
336336
var input = document.createElement('input');
337337
input.type = 'file';
338338
input.onchange = onchange;
339339
input.click();
340-
340+
341341

342342
async function onchange(){
343-
343+
344344
var file = input.files[0];
345345
var txt = await file.text();
346346
cert.textContent = txt;
@@ -351,7 +351,7 @@ <h1 class=visually-hidden>
351351

352352

353353
btn.cert.extract = async function(e){
354-
354+
355355
var pem = cert.textContent.trim();
356356
var pem = await extract(pem);
357357
key.textContent = pem;
@@ -360,15 +360,15 @@ <h1 class=visually-hidden>
360360

361361

362362
btn.key.copy = async function(e){
363-
363+
364364
var txt = key.textContent.trim();
365365
await navigator.clipboard.writeText(txt);
366366

367367
}//copy
368368

369369

370370
btn.key.save = function(e){
371-
371+
372372
var txt = key.textContent.trim();
373373
var blob = new Blob([txt]);
374374
var url = window.URL.createObjectURL(blob);
@@ -383,22 +383,22 @@ <h1 class=visually-hidden>
383383

384384

385385
async function extract(pem){
386-
386+
387387
var cert = pki.certificateFromPem(pem);
388388
var key = cert.publicKey;
389389
var pem = pki.publicKeyToPem(key);
390390
return pem;
391-
391+
392392
}//extract
393393

394394

395-
396-
397-
395+
396+
397+
398398
</script>
399-
400-
401-
399+
400+
401+
402402
</html>
403403

404404

0 commit comments

Comments
 (0)