From c7af660bfc2d100117d0d5e7da16ab62d27595ba Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Wed, 20 Jan 2016 04:28:44 -0500
Subject: [PATCH] Fix boundary separator in signed messages
---
plugins/enigma/lib/enigma_mime_message.php | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/plugins/enigma/lib/enigma_mime_message.php b/plugins/enigma/lib/enigma_mime_message.php
index 07afef5..a9b5536 100644
--- a/plugins/enigma/lib/enigma_mime_message.php
+++ b/plugins/enigma/lib/enigma_mime_message.php
@@ -142,6 +142,8 @@
public function addPGPSignature($body)
{
$this->signature = $body;
+ // Reset Content-Type to be overwritten with valid boundary
+ unset($this->headers['Content-Type']);
}
/**
@@ -152,6 +154,8 @@
public function setPGPEncryptedBody($body)
{
$this->encrypted = $body;
+ // Reset Content-Type to be overwritten with valid boundary
+ unset($this->headers['Content-Type']);
}
/**
@@ -177,13 +181,13 @@
$this->checkParams();
if ($this->type == self::PGP_SIGNED) {
- $body = "This is an OpenPGP/MIME signed message (RFC 4880 and 3156)";
$params = array(
+ 'preamble' => "This is an OpenPGP/MIME signed message (RFC 4880 and 3156)",
'content_type' => "multipart/signed; micalg=pgp-sha1; protocol=\"application/pgp-signature\"",
'eol' => $this->build_params['eol'],
);
- $message = new Mail_mimePart($body, $params);
+ $message = new Mail_mimePart('', $params);
if (!empty($this->body)) {
$headers = $this->message->headers();
@@ -206,13 +210,13 @@
}
}
else if ($this->type == self::PGP_ENCRYPTED) {
- $body = "This is an OpenPGP/MIME encrypted message (RFC 4880 and 3156)";
$params = array(
+ 'preamble' => "This is an OpenPGP/MIME encrypted message (RFC 4880 and 3156)",
'content_type' => "multipart/encrypted; protocol=\"application/pgp-encrypted\"",
'eol' => $this->build_params['eol'],
);
- $message = new Mail_mimePart($body, $params);
+ $message = new Mail_mimePart('', $params);
$message->addSubpart('Version: 1', array(
'content_type' => 'application/pgp-encrypted',
--
Gitblit v1.9.1