From 73dea575a46bc8314cf5322d2724e180835e1158 Mon Sep 17 00:00:00 2001 From: Roman Kazakov Date: Wed, 15 Jun 2022 17:53:54 +0300 Subject: [PATCH] bug fix privateKeyToPutty function fix this problem: https://github.com/digitalbazaar/forge/issues/952 --- lib/ssh.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ssh.js b/lib/ssh.js index 6480203a8..26d35f072 100644 --- a/lib/ssh.js +++ b/lib/ssh.js @@ -202,7 +202,7 @@ ssh.getPublicKeyFingerprint = function(key, options) { function _addBigIntegerToBuffer(buffer, val) { var hexVal = val.toString(16); // ensure 2s complement +ve - if(hexVal[0] >= '8') { + if(hexVal[0] >= '8' && (hexVal.length % 2 === 0)) { hexVal = '00' + hexVal; } var bytes = forge.util.hexToBytes(hexVal);