From f5f3a902755901e27a65c5043b04141b1e28c725 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Tue, 20 Feb 2024 11:10:43 +0100 Subject: [PATCH] Only ask S/MIME private key passphrase when it is encrypted #259 --- dev/View/Popup/Compose.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dev/View/Popup/Compose.js b/dev/View/Popup/Compose.js index 39a85c0db..3cbbeeba9 100644 --- a/dev/View/Popup/Compose.js +++ b/dev/View/Popup/Compose.js @@ -1538,8 +1538,10 @@ export class ComposePopupView extends AbstractViewPopup { } else if (this.canSMimeSign()) { params.signCertificate = identity.smimeCertificate(); params.signPrivateKey = identity.smimeKey(); - const pass = await AskPopupView.password('S/MIME key', 'CRYPTO/SIGN'); - params.signPassphrase = pass?.password; + if (identity.smimeKey().includes('-----BEGIN ENCRYPTED PRIVATE KEY-----')) { + const pass = await AskPopupView.password('S/MIME private key', 'CRYPTO/SIGN'); + params.signPassphrase = pass?.password; + } } } if (encrypt) { @@ -1555,7 +1557,7 @@ export class ComposePopupView extends AbstractViewPopup { params.encryptFingerprints = JSON.stringify(GnuPGUserStore.getPublicKeyFingerprints(recipients)); // } else { // // S/MIME -// params.encryptCertificates = ''; +// params.encryptCertificates = []; } else { throw 'Encryption with ' + encrypt + ' not yet implemented'; }