working der and pem generation #2

Merged
coolaj86 merged 7 commits from lastlink/bluecrypt-keypairs.js:master into master 2019-04-27 05:33:09 +00:00
4 changed files with 10 additions and 5 deletions
Showing only changes of commit 1b01c2c413 - Show all commits

3
app.js
View File

@ -43,6 +43,9 @@ function run() {
};
console.log('opts', opts);
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-loading').hidden = true;

View File

@ -66,8 +66,10 @@
<summary>ACME Account Response</summary>
<pre><code class="js-acme-account-response">&nbsp;</code></pre>
</details>
<script src="./lib/bluecrypt-encoding.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/keypairs.js"></script>
<script src="./lib/acme.js"></script>

View File

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

View File

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