working der generation

This commit is contained in:
lastlink 2019-04-26 23:27:08 -04:00
parent 2e0549af5a
commit 1b01c2c413
4 changed files with 10 additions and 5 deletions

3
app.js
View File

@ -43,6 +43,9 @@ function run() {
}; };
console.log('opts', opts); console.log('opts', opts);
Keypairs.generate(opts).then(function (results) { Keypairs.generate(opts).then(function (results) {
var der = x509.packPkcs8(results.private);
console.log(der)
// Pem.encode(x509.packPkcs8(privateJwk))
$('.js-jwk').innerText = JSON.stringify(results, null, 2); $('.js-jwk').innerText = JSON.stringify(results, null, 2);
// //
$('.js-loading').hidden = true; $('.js-loading').hidden = true;

View File

@ -66,8 +66,10 @@
<summary>ACME Account Response</summary> <summary>ACME Account Response</summary>
<pre><code class="js-acme-account-response">&nbsp;</code></pre> <pre><code class="js-acme-account-response">&nbsp;</code></pre>
</details> </details>
<script src="./lib/bluecrypt-encoding.js"></script>
<script src="./lib/ecdsa.js"></script> <script src="./lib/ecdsa.js"></script>
<script src="./lib/asn1-packer.js"></script>
<script src="./lib/x509.js"></script>
<script src="./lib/rsa.js"></script> <script src="./lib/rsa.js"></script>
<script src="./lib/keypairs.js"></script> <script src="./lib/keypairs.js"></script>
<script src="./lib/acme.js"></script> <script src="./lib/acme.js"></script>

View File

@ -1,6 +1,6 @@
(function (exports) { (function (exports) {
var Enc = exports.BluecryptEncoding = {}; var Enc = exports.Enc = {};
Enc.bufToBin = function (buf) { Enc.bufToBin = function (buf) {
var bin = ''; var bin = '';

View File

@ -128,7 +128,7 @@
var x = Enc.base64ToHex(jwk.x); var x = Enc.base64ToHex(jwk.x);
var y = Enc.base64ToHex(jwk.y); var y = Enc.base64ToHex(jwk.y);
var objId = ('P-256' === jwk.crv) ? OBJ_ID_EC : OBJ_ID_EC_384; var objId = ('P-256' === jwk.crv) ? OBJ_ID_EC : OBJ_ID_EC_384;
return Enc.hexToUint8( return Enc.hexToBuf(
ASN1('30' ASN1('30'
, ASN1.UInt('01') , ASN1.UInt('01')
, ASN1('04', d) , ASN1('04', d)
@ -141,7 +141,7 @@
var x = Enc.base64ToHex(jwk.x); var x = Enc.base64ToHex(jwk.x);
var y = Enc.base64ToHex(jwk.y); var y = Enc.base64ToHex(jwk.y);
var objId = ('P-256' === jwk.crv) ? OBJ_ID_EC : OBJ_ID_EC_384; var objId = ('P-256' === jwk.crv) ? OBJ_ID_EC : OBJ_ID_EC_384;
return Enc.hexToUint8( return Enc.hexToBuf(
ASN1('30' ASN1('30'
, ASN1.UInt('00') , ASN1.UInt('00')
, ASN1('30' , ASN1('30'
@ -159,7 +159,7 @@
var x = Enc.base64ToHex(jwk.x); var x = Enc.base64ToHex(jwk.x);
var y = Enc.base64ToHex(jwk.y); var y = Enc.base64ToHex(jwk.y);
var objId = ('P-256' === jwk.crv) ? OBJ_ID_EC : OBJ_ID_EC_384; var objId = ('P-256' === jwk.crv) ? OBJ_ID_EC : OBJ_ID_EC_384;
return Enc.hexToUint8( return Enc.hexToBuf(
ASN1('30' ASN1('30'
, ASN1('30' , ASN1('30'
, OBJ_ID_EC_PUB , OBJ_ID_EC_PUB