v1.2.2: handle padding of private key

This commit is contained in:
AJ ONeal 2018-12-09 01:57:29 -07:00
parent 7a1d0bbe76
commit b5c919b557
2 changed files with 4 additions and 2 deletions

View File

@ -197,7 +197,9 @@ SSH.parsePublicKey = function (ssh) {
while (0x00 === y[0]) { y = y.slice(1); } while (0x00 === y[0]) { y = y.slice(1); }
if (els[3]) { if (els[3]) {
ssh.jwk.d = Enc.bufToUrlBase64(els[3]); d = els[3];
while (0x00 === d[0]) { d = d.slice(1); }
ssh.jwk.d = Enc.bufToUrlBase64(d);
} }
ssh.jwk.x = Enc.bufToUrlBase64(x); ssh.jwk.x = Enc.bufToUrlBase64(x);
ssh.jwk.y = Enc.bufToUrlBase64(y); ssh.jwk.y = Enc.bufToUrlBase64(y);

View File

@ -1,6 +1,6 @@
{ {
"name": "ssh-to-jwk", "name": "ssh-to-jwk",
"version": "1.2.1", "version": "1.2.2",
"description": "💯 SSH to JWK in a lightweight, zero-dependency library.", "description": "💯 SSH to JWK in a lightweight, zero-dependency library.",
"homepage": "https://git.coolaj86.com/coolaj86/ssh-to-jwk.js", "homepage": "https://git.coolaj86.com/coolaj86/ssh-to-jwk.js",
"main": "index.js", "main": "index.js",