working der and pem generation #2
12
app.js
12
app.js
|
@ -34,6 +34,8 @@ function run() {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
$('.js-loading').hidden = false;
|
$('.js-loading').hidden = false;
|
||||||
$('.js-jwk').hidden = true;
|
$('.js-jwk').hidden = true;
|
||||||
|
$('.js-toc-der').hidden = true;
|
||||||
|
$('.js-toc-pem').hidden = true;
|
||||||
$$('input').map(function ($el) { $el.disabled = true; });
|
$$('input').map(function ($el) { $el.disabled = true; });
|
||||||
$$('button').map(function ($el) { $el.disabled = true; });
|
$$('button').map(function ($el) { $el.disabled = true; });
|
||||||
var opts = {
|
var opts = {
|
||||||
|
@ -43,20 +45,22 @@ function run() {
|
||||||
};
|
};
|
||||||
console.log('opts', opts);
|
console.log('opts', opts);
|
||||||
Keypairs.generate(opts).then(function (results) {
|
Keypairs.generate(opts).then(function (results) {
|
||||||
|
if (opts.kty == 'EC') {
|
||||||
var der = x509.packPkcs8(results.private);
|
var der = x509.packPkcs8(results.private);
|
||||||
var pem = Eckles.export({ jwk: results.private })
|
var pem = Eckles.export({ jwk: results.private })
|
||||||
|
|
||||||
$('.js-jwk').innerText = JSON.stringify(results, null, 2);
|
|
||||||
$('.js-der').innerText = JSON.stringify(der, null, 2);
|
$('.js-der').innerText = JSON.stringify(der, null, 2);
|
||||||
$('.js-input-pem').innerText = pem;
|
$('.js-input-pem').innerText = pem;
|
||||||
|
$('.js-toc-der').hidden = false;
|
||||||
|
$('.js-toc-pem').hidden = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.js-jwk').innerText = JSON.stringify(results, null, 2);
|
||||||
//
|
//
|
||||||
$('.js-loading').hidden = true;
|
$('.js-loading').hidden = true;
|
||||||
$('.js-jwk').hidden = false;
|
$('.js-jwk').hidden = false;
|
||||||
$$('input').map(function ($el) { $el.disabled = false; });
|
$$('input').map(function ($el) { $el.disabled = false; });
|
||||||
$$('button').map(function ($el) { $el.disabled = false; });
|
$$('button').map(function ($el) { $el.disabled = false; });
|
||||||
$('.js-toc-jwk').hidden = false;
|
$('.js-toc-jwk').hidden = false;
|
||||||
$('.js-toc-der').hidden = false;
|
|
||||||
$('.js-toc-pem').hidden = false;
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue