From 9436218561ccb9655895821002d72c20cf13427d Mon Sep 17 00:00:00 2001 From: Tim Bazuin Date: Sat, 3 Aug 2019 20:56:59 +0200 Subject: [PATCH] generating an embedded server config with a decrypted private key now also works --- public/js/pages/configBuilder.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/public/js/pages/configBuilder.js b/public/js/pages/configBuilder.js index 7c9aa81..cb7d1b6 100644 --- a/public/js/pages/configBuilder.js +++ b/public/js/pages/configBuilder.js @@ -73,11 +73,10 @@ $(function () { var keyContent = text.substring(keyStartOffset, keyEndOffset); - var decryptedKey = 'DECRYPTED_KEY'; + var decryptedPrivateKey = forge.pki.decryptRsaPrivateKey(keyContent.trim(), keyPassword); + var decryptedPem = forge.pki.privateKeyToPem(decryptedPrivateKey); - // actual decryption happens here - - return text.substring(0, keyStartOffset) + decryptedKey + text.substring(keyEndOffset); + return text.substring(0, keyStartOffset) + decryptedPem + text.substring(keyEndOffset); } function saveText(text, fileName) {