MailMimeParser 1.1

PrivacyHelper extends AbstractHelper

Provides routines to set or retrieve the signature part of a signed message.

Tags
author

Zaahid Bateson

Table of Contents

$mimePartFactory  : MimePartFactory
$partBuilderFactory  : PartBuilderFactory
$uuEncodedPartFactory  : UUEncodedPartFactory
$genericHelper  : GenericHelper
$multipartHelper  : MultipartHelper
__construct()  : mixed
Constructor
ensureHtmlPartFirstForSignedMessage()  : mixed
Ensures a non-text part comes first in a signed multipart/alternative message as some clients seem to prefer the first content part if the client doesn't understand multipart/signed.
getSignaturePart()  : MimePart
Returns the signature part of a multipart/signed message or null.
getSignedMessageAsString()  : string
Returns a string containing the entire body (content) of a signed message for verification or calculating a signature.
getSignedMessageStream()  : StreamInterface
Returns a stream that can be used to read the content part of a signed message, which can be used to sign an email or verify a signature.
overwrite8bitContentEncoding()  : mixed
Loops over parts of the message and sets the content-transfer-encoding header to quoted-printable for text/* mime parts, and to base64 otherwise for parts that are '8bit' encoded.
setMessageAsMultipartSigned()  : mixed
The passed message is set as multipart/signed, and a new part is created below it with content headers, content and children copied from the message.
setSignature()  : mixed
Sets the signature of the message to $body, creating a signature part if one doesn't exist.

Properties

Methods

ensureHtmlPartFirstForSignedMessage()

Ensures a non-text part comes first in a signed multipart/alternative message as some clients seem to prefer the first content part if the client doesn't understand multipart/signed.

public ensureHtmlPartFirstForSignedMessage(Message $message) : mixed
Parameters
$message : Message
Return values
mixed

getSignaturePart()

Returns the signature part of a multipart/signed message or null.

public getSignaturePart(Message $message) : MimePart

The signature part is determined to always be the 2nd child of a multipart/signed message, the first being the 'body'.

Using the 'protocol' parameter of the Content-Type header is unreliable in some instances (for instance a difference of x-pgp-signature versus pgp-signature).

Parameters
$message : Message
Return values
MimePart

getSignedMessageAsString()

Returns a string containing the entire body (content) of a signed message for verification or calculating a signature.

public getSignedMessageAsString(Message $message) : string

Non-CRLF new lines are replaced to always be CRLF.

Parameters
$message : Message
Return values
string

or null if the message doesn't have any children

getSignedMessageStream()

Returns a stream that can be used to read the content part of a signed message, which can be used to sign an email or verify a signature.

public getSignedMessageStream(Message $message) : StreamInterface

The method simply returns the stream for the first child. No verification of whether the message is in fact a signed message is performed.

Note that unlike getSignedMessageAsString, getSignedMessageStream doesn't replace new lines.

Parameters
$message : Message
Return values
StreamInterface

or null if the message doesn't have any children

overwrite8bitContentEncoding()

Loops over parts of the message and sets the content-transfer-encoding header to quoted-printable for text/* mime parts, and to base64 otherwise for parts that are '8bit' encoded.

public overwrite8bitContentEncoding(Message $message) : mixed

Used for multipart/signed messages which doesn't support 8bit transfer encodings.

Parameters
$message : Message
Return values
mixed

setMessageAsMultipartSigned()

The passed message is set as multipart/signed, and a new part is created below it with content headers, content and children copied from the message.

public setMessageAsMultipartSigned(Message $message, string $micalg, string $protocol) : mixed
Parameters
$message : Message
$micalg : string
$protocol : string
Return values
mixed

setSignature()

Sets the signature of the message to $body, creating a signature part if one doesn't exist.

public setSignature(Message $message, string $body) : mixed
Parameters
$message : Message
$body : string
Return values
mixed

Search results