From 04598bdfb11198c6bd3d1d70616341815c346b45 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Tue, 31 Mar 2015 13:42:46 -0400
Subject: [PATCH] Enigma: Handle signed content inside of encrypted message

---
 plugins/enigma/README                |    1 -
 plugins/enigma/lib/enigma_engine.php |    5 +++++
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/plugins/enigma/README b/plugins/enigma/README
index 7aadbd0..25a1607 100644
--- a/plugins/enigma/README
+++ b/plugins/enigma/README
@@ -15,7 +15,6 @@
 TODO (must have):
 
 - Fix issues with enabled messages_cache
-- PGP: Handling of signed inside encrypted message
 - Make working with gnupg-2.x
 - Keys export to file
 - Disable Reply/Forward options when viewing encrypted messages
diff --git a/plugins/enigma/lib/enigma_engine.php b/plugins/enigma/lib/enigma_engine.php
index 9b92994..fd25944 100644
--- a/plugins/enigma/lib/enigma_engine.php
+++ b/plugins/enigma/lib/enigma_engine.php
@@ -585,6 +585,11 @@
             $part->body_modified = true;
             $part->encrypted     = true;
 
+            // PGP signed inside? verify signature
+            if (preg_match('/^-----BEGIN PGP SIGNED MESSAGE-----/', $body)) {
+                $this->parse_plain_signed($p, $body);
+            }
+
             // Encrypted plain message may contain encrypted attachments
             // in such case attachments have .pgp extension and application/octet-stream.
             // This is what happens when you select "Encrypt each attachment separately

--
Gitblit v1.9.1