PrivacyHelper
extends AbstractHelper
in package
Provides routines to set or retrieve the signature part of a signed message.
Tags
Table of Contents
- $mimePartFactory : IMimePartFactory
- $uuEncodedPartFactory : IUUEncodedPartFactory
- $genericHelper : GenericHelper
- $multipartHelper : MultipartHelper
- __construct() : mixed
- getSignedMessageAsString() : string|null
- Returns a string containing the entire body (content) of a signed message for verification or calculating a signature.
- getSignedMessageStream() : StreamInterface|null
- 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() : static
- 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() : static
- 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() : static
- Sets the signature of the message to $body, creating a signature part if one doesn't exist.
Properties
$mimePartFactory
protected
IMimePartFactory
$mimePartFactory
to create parts for attachments/content
$uuEncodedPartFactory
protected
IUUEncodedPartFactory
$uuEncodedPartFactory
to create parts for attachments
$genericHelper
private
GenericHelper
$genericHelper
a GenericHelper instance
$multipartHelper
private
MultipartHelper
$multipartHelper
a MultipartHelper instance
Methods
__construct()
public
__construct(IMimePartFactory $mimePartFactory, IUUEncodedPartFactory $uuEncodedPartFactory, GenericHelper $genericHelper, MultipartHelper $multipartHelper) : mixed
Parameters
- $mimePartFactory : IMimePartFactory
- $uuEncodedPartFactory : IUUEncodedPartFactory
- $genericHelper : GenericHelper
- $multipartHelper : MultipartHelper
Return values
mixed —getSignedMessageAsString()
Returns a string containing the entire body (content) of a signed message for verification or calculating a signature.
public
getSignedMessageAsString(IMessage $message) : string|null
Non-CRLF new lines are replaced to always be CRLF.
Parameters
- $message : IMessage
Return values
string|null —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(IMessage $message) : StreamInterface|null
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 : IMessage
Return values
StreamInterface|null —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(IMessage $message) : static
Used for multipart/signed messages which doesn't support 8bit transfer encodings.
Parameters
- $message : IMessage
Return values
static —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(IMessage $message, string $micalg, string $protocol) : static
Parameters
- $message : IMessage
- $micalg : string
- $protocol : string
Return values
static —setSignature()
Sets the signature of the message to $body, creating a signature part if one doesn't exist.
public
setSignature(IMessage $message, string $body) : static
Parameters
- $message : IMessage
- $body : string