From 8d2968572a569ed77a4d7c14ae1dc69935fa847e Mon Sep 17 00:00:00 2001 From: TheCatLady <52870424+TheCatLady@users.noreply.github.com> Date: Tue, 26 Oct 2021 05:49:27 -0400 Subject: [PATCH] fix(email): use decrypted private key (#2232) --- server/lib/email/openpgpEncrypt.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/server/lib/email/openpgpEncrypt.ts b/server/lib/email/openpgpEncrypt.ts index 263f2b1f2..0e5fc8729 100644 --- a/server/lib/email/openpgpEncrypt.ts +++ b/server/lib/email/openpgpEncrypt.ts @@ -51,11 +51,12 @@ class PGPEncryptor extends Transform { // Only sign the message if private key and password exist if (this._signingKey && this._password) { - privateKey = await openpgp.readPrivateKey({ - armoredKey: this._signingKey, + privateKey = await openpgp.decryptKey({ + privateKey: await openpgp.readPrivateKey({ + armoredKey: this._signingKey, + }), + passphrase: this._password, }); - - await openpgp.decryptKey({ privateKey, passphrase: this._password }); } const emailPartDelimiter = '\r\n\r\n';