|
|
@ -25,6 +25,7 @@ class enigma_mime_message extends Mail_mime
|
|
|
|
protected $body;
|
|
|
|
protected $body;
|
|
|
|
protected $signature;
|
|
|
|
protected $signature;
|
|
|
|
protected $encrypted;
|
|
|
|
protected $encrypted;
|
|
|
|
|
|
|
|
protected $micalg;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -119,10 +120,12 @@ class enigma_mime_message extends Mail_mime
|
|
|
|
* Register signature attachment
|
|
|
|
* Register signature attachment
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param string Signature body
|
|
|
|
* @param string Signature body
|
|
|
|
|
|
|
|
* @param string Hash algorithm name
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function addPGPSignature($body)
|
|
|
|
public function addPGPSignature($body, $algorithm = null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$this->signature = $body;
|
|
|
|
$this->signature = $body;
|
|
|
|
|
|
|
|
$this->micalg = $algorithm;
|
|
|
|
|
|
|
|
|
|
|
|
// Reset Content-Type to be overwritten with valid boundary
|
|
|
|
// Reset Content-Type to be overwritten with valid boundary
|
|
|
|
unset($this->headers['Content-Type']);
|
|
|
|
unset($this->headers['Content-Type']);
|
|
|
@ -168,10 +171,14 @@ class enigma_mime_message extends Mail_mime
|
|
|
|
if ($this->type == self::PGP_SIGNED) {
|
|
|
|
if ($this->type == self::PGP_SIGNED) {
|
|
|
|
$params = array(
|
|
|
|
$params = array(
|
|
|
|
'preamble' => "This is an OpenPGP/MIME signed message (RFC 4880 and 3156)",
|
|
|
|
'preamble' => "This is an OpenPGP/MIME signed message (RFC 4880 and 3156)",
|
|
|
|
'content_type' => "multipart/signed; micalg=pgp-sha1; protocol=\"application/pgp-signature\"",
|
|
|
|
'content_type' => "multipart/signed; protocol=\"application/pgp-signature\"",
|
|
|
|
'eol' => $this->build_params['eol'],
|
|
|
|
'eol' => $this->build_params['eol'],
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($this->micalg) {
|
|
|
|
|
|
|
|
$params['content_type'] .= "; micalg=pgp-" . $this->micalg;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$message = new Mail_mimePart('', $params);
|
|
|
|
$message = new Mail_mimePart('', $params);
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($this->body)) {
|
|
|
|
if (!empty($this->body)) {
|
|
|
@ -279,9 +286,13 @@ class enigma_mime_message extends Mail_mime
|
|
|
|
$this->build_params['boundary'] = $boundary;
|
|
|
|
$this->build_params['boundary'] = $boundary;
|
|
|
|
|
|
|
|
|
|
|
|
if ($this->type == self::PGP_SIGNED) {
|
|
|
|
if ($this->type == self::PGP_SIGNED) {
|
|
|
|
$headers['Content-Type'] = "multipart/signed; micalg=pgp-sha1;$eol"
|
|
|
|
$headers['Content-Type'] = "multipart/signed;$eol"
|
|
|
|
." protocol=\"application/pgp-signature\";$eol"
|
|
|
|
." protocol=\"application/pgp-signature\";$eol"
|
|
|
|
." boundary=\"$boundary\"";
|
|
|
|
." boundary=\"$boundary\"";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($this->micalg) {
|
|
|
|
|
|
|
|
$headers['Content-Type'] .= ";{$eol} micalg=pgp-" . $this->micalg;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ($this->type == self::PGP_ENCRYPTED) {
|
|
|
|
else if ($this->type == self::PGP_ENCRYPTED) {
|
|
|
|
$headers['Content-Type'] = "multipart/encrypted;$eol"
|
|
|
|
$headers['Content-Type'] = "multipart/encrypted;$eol"
|
|
|
|