From b5c919b5573cdb905e5f512ee896a301055e563e Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 9 Dec 2018 01:57:29 -0700 Subject: [PATCH] v1.2.2: handle padding of private key --- lib/ssh-parser.js | 4 +++- package.json | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ssh-parser.js b/lib/ssh-parser.js index a9e464f..f15bcb1 100644 --- a/lib/ssh-parser.js +++ b/lib/ssh-parser.js @@ -197,7 +197,9 @@ SSH.parsePublicKey = function (ssh) { while (0x00 === y[0]) { y = y.slice(1); } 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.y = Enc.bufToUrlBase64(y); diff --git a/package.json b/package.json index 2d1c2a5..3790693 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ssh-to-jwk", - "version": "1.2.1", + "version": "1.2.2", "description": "💯 SSH to JWK in a lightweight, zero-dependency library.", "homepage": "https://git.coolaj86.com/coolaj86/ssh-to-jwk.js", "main": "index.js",