Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/roundcube/roundcubemail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2021-03-06 10:52:23 +0300
committerAleksander Machniak <alec@alec.pl>2021-03-06 11:03:47 +0300
commitcbb8cfcb29afd7a83a5d08cef1eb7ec2db645abc (patch)
treee9b9310afdf7bf0e6487eb7aa92db516687972fd
parente1af03c8a46e568a0ead223c2223910402fa81c6 (diff)
Enigma: Fix bug where signature verification could fail for non-ascii bodies (#7919)
-rw-r--r--CHANGELOG1
-rw-r--r--plugins/enigma/lib/enigma_engine.php13
2 files changed, 9 insertions, 5 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 3abf60475..1f732b8ca 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
+- Enigma: Fix bug where signature verification could fail for non-ascii bodies (#7919)
- Fix bug causing some HTML message content to be not centered in Elastic skin (#7911)
RELEASE 1.4.11
diff --git a/plugins/enigma/lib/enigma_engine.php b/plugins/enigma/lib/enigma_engine.php
index 0f420bbe8..4dbb464a5 100644
--- a/plugins/enigma/lib/enigma_engine.php
+++ b/plugins/enigma/lib/enigma_engine.php
@@ -874,6 +874,10 @@ class enigma_engine
private function pgp_verify(&$msg_body, $sig_body = null)
{
// @TODO: Handle big bodies using (temp) files
+
+ // Get rid of possible non-ascii characters (#5962)
+ $sig_body = preg_replace('/[^\x00-\x7F]/', '', $sig_body);
+
$sig = $this->pgp_driver->verify($msg_body, $sig_body);
if (($sig instanceof enigma_error) && $sig->getCode() != enigma_error::KEYNOTFOUND) {
@@ -894,6 +898,10 @@ class enigma_engine
private function pgp_decrypt(&$msg_body, &$signature = null)
{
// @TODO: Handle big bodies using (temp) files
+
+ // Get rid of possible non-ascii characters (#5962)
+ $msg_body = preg_replace('/[^\x00-\x7F]/', '', $msg_body);
+
$keys = $this->get_passwords();
$result = $this->pgp_driver->decrypt($msg_body, $keys, $signature);
@@ -1227,11 +1235,6 @@ class enigma_engine
}
else {
$body = $msg->get_part_body($part->mime_id, false);
-
- // Convert charset to get rid of possible non-ascii characters (#5962)
- if ($part->charset && stripos($part->charset, 'ASCII') === false) {
- $body = rcube_charset::convert($body, $part->charset, 'US-ASCII');
- }
}
return $body;