File 0001-Enigma-Optional-support-for-passwordless-keys-7265.patch of Package roundcubemail
From 3e4a37339e6a4f356f26a47d981ca86a763e4bba Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Tue, 25 May 2021 15:37:57 +0200
Subject: [PATCH] Enigma: Optional support for passwordless keys (#7265)
---
plugins/enigma/config.inc.php.dist | 3 +++
plugins/enigma/lib/enigma_engine.php | 4 ++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/plugins/enigma/config.inc.php.dist b/plugins/enigma/config.inc.php.dist
index fc620587e..c0c635f3c 100644
--- a/plugins/enigma/config.inc.php.dist
+++ b/plugins/enigma/config.inc.php.dist
@@ -65,6 +65,9 @@ $config['enigma_attach_pubkey'] = false;
// When set to 0 passwords will be stored for the whole session.
$config['enigma_password_time'] = 5;
+// Enable support for private keys without passwords.
+$config['enigma_passwordless'] = false;
+
// With this option you can lock composing options
// of the plugin forcing the user to use configured settings.
// The array accepts: 'sign', 'encrypt', 'pubkey'.
diff --git a/plugins/enigma/lib/enigma_engine.php b/plugins/enigma/lib/enigma_engine.php
index 4dbb464a5..650a0960c 100644
--- a/plugins/enigma/lib/enigma_engine.php
+++ b/plugins/enigma/lib/enigma_engine.php
@@ -147,7 +147,7 @@ class enigma_engine
$passwords = $this->get_passwords();
$pass = $passwords[$key->id];
- if ($pass === null) {
+ if ($pass === null && !$this->rc->config->get('enigma_passwordless')) {
// ask for password
$error = array('missing' => array($key->id => $key->name));
return new enigma_error(enigma_error::BADPASS, '', $error);
@@ -249,7 +249,7 @@ class enigma_engine
$passwords = $this->get_passwords();
$sign_pass = $passwords[$sign_key->id];
- if ($sign_pass === null) {
+ if ($sign_pass === null && !$this->rc->config->get('enigma_passwordless')) {
// ask for password
$error = array('missing' => array($sign_key->id => $sign_key->name));
return new enigma_error(enigma_error::BADPASS, '', $error);
--
2.31.1