Swift_Signers_SMimeSigner
in package
implements
Swift_Signers_BodySigner
MIME Message Signer used to apply S/MIME Signature/Encryption to a message.
Tags
Interfaces, Classes and Traits
- Swift_Signers_BodySigner
- Body Signer Interface used to apply Body-Based Signature to a message.
Table of Contents
- $encryptCert : mixed
- $encryptCipher : mixed
- $encryptLevel : mixed
- $encryptOptions : mixed
- $extraCerts : mixed
- $headerFactory : Swift_Mime_SimpleHeaderFactory
- $replacementFactory : Swift_StreamFilters_StringReplacementFilterFactory
- $signCertificate : mixed
- $signLevel : mixed
- $signOptions : mixed
- $signPrivateKey : mixed
- $signThenEncrypt : mixed
- $wrapFullMessage : mixed
- __construct() : mixed
- Constructor.
- getAlteredHeaders() : array<string|int, mixed>
- Return the list of header a signer might tamper.
- getSignCertificate() : string
- getSignPrivateKey() : string
- isSignThenEncrypt() : bool
- reset() : $this
- Resets internal states.
- setEncryptCertificate() : $this
- Set the certificate location to use for encryption.
- setSignCertificate() : $this
- Set the certificate location to use for signing.
- setSignThenEncrypt() : $this
- Set perform signing before encryption.
- setWrapFullMessage() : $this
- Specify whether to wrap the entire MIME message in the S/MIME message.
- signMessage() : $this
- Change the Swift_Message to apply the signing.
- clearAllHeaders() : mixed
- Remove all headers from a Swift message.
- copyFromOpenSSLOutput() : mixed
- copyHeader() : mixed
- Copy a single header from one Swift message to another.
- copyHeaders() : mixed
- Copy named headers from one Swift message to another.
- parseSSLOutput() : mixed
- parseStream() : array<string|int, mixed>
- This message will parse the headers of a MIME email byte stream and return an array that contains the headers as an associative array and the email body as a string.
- smimeEncryptMessage() : mixed
- Encrypt a Swift message.
- smimeSignMessage() : mixed
- Sign a Swift message.
- streamToMime() : mixed
- Merges an OutputByteStream from OpenSSL to a Swift_Message.
- wrapMimeMessage() : Swift_MimePart
- Wraps a Swift_Message in a message/rfc822 MIME part.
Properties
$encryptCert
protected
mixed
$encryptCert
$encryptCipher
protected
mixed
$encryptCipher
$encryptLevel
protected
mixed
$encryptLevel
$encryptOptions
protected
mixed
$encryptOptions
$extraCerts
protected
mixed
$extraCerts
=
ull
$headerFactory
protected
Swift_Mime_SimpleHeaderFactory
$headerFactory
$replacementFactory
protected
Swift_StreamFilters_StringReplacementFilterFactory
$replacementFactory
$signCertificate
protected
mixed
$signCertificate
$signLevel
protected
mixed
$signLevel
$signOptions
protected
mixed
$signOptions
$signPrivateKey
protected
mixed
$signPrivateKey
$signThenEncrypt
protected
mixed
$signThenEncrypt
= rue
$wrapFullMessage
protected
mixed
$wrapFullMessage
= alse
Methods
__construct()
Constructor.
public
__construct([string|null $signCertificate = null ][, string|null $signPrivateKey = null ][, string|null $encryptCertificate = null ]) : mixed
Parameters
- $signCertificate : string|null = null
- $signPrivateKey : string|null = null
- $encryptCertificate : string|null = null
Return values
mixed —getAlteredHeaders()
Return the list of header a signer might tamper.
public
getAlteredHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed> —getSignCertificate()
public
getSignCertificate() : string
Return values
string —getSignPrivateKey()
public
getSignPrivateKey() : string
Return values
string —isSignThenEncrypt()
public
isSignThenEncrypt() : bool
Return values
bool —reset()
Resets internal states.
public
reset() : $this
Return values
$this —setEncryptCertificate()
Set the certificate location to use for encryption.
public
setEncryptCertificate(string|array<string|int, mixed> $recipientCerts[, int $cipher = null ]) : $this
Parameters
- $recipientCerts : string|array<string|int, mixed>
-
Either an single X.509 certificate, or an assoc array of X.509 certificates.
- $cipher : int = null
Tags
Return values
$this —setSignCertificate()
Set the certificate location to use for signing.
public
setSignCertificate(string $certificate[, string|array<string|int, mixed> $privateKey = null ][, int $signOptions = PKCS7_DETACHED ][, string $extraCerts = null ]) : $this
Parameters
- $certificate : string
- $privateKey : string|array<string|int, mixed> = null
-
If the key needs an passphrase use array('file-location', 'passphrase') instead
- $signOptions : int = PKCS7_DETACHED
-
Bitwise operator options for openssl_pkcs7_sign()
- $extraCerts : string = null
-
A file containing intermediate certificates needed by the signing certificate
Tags
Return values
$this —setSignThenEncrypt()
Set perform signing before encryption.
public
setSignThenEncrypt([bool $signThenEncrypt = true ]) : $this
The default is to first sign the message and then encrypt. But some older mail clients, namely Microsoft Outlook 2000 will work when the message first encrypted. As this goes against the official specs, its recommended to only use 'encryption -> signing' when specifically targeting these 'broken' clients.
Parameters
- $signThenEncrypt : bool = true
Return values
$this —setWrapFullMessage()
Specify whether to wrap the entire MIME message in the S/MIME message.
public
setWrapFullMessage(bool $wrap) : $this
According to RFC5751 section 3.1: In order to protect outer, non-content-related message header fields (for instance, the "Subject", "To", "From", and "Cc" fields), the sending client MAY wrap a full MIME message in a message/rfc822 wrapper in order to apply S/MIME security services to these header fields. It is up to the receiving client to decide how to present this "inner" header along with the unprotected "outer" header.
Parameters
- $wrap : bool
Return values
$this —signMessage()
Change the Swift_Message to apply the signing.
public
signMessage(Swift_Message $message) : $this
Parameters
- $message : Swift_Message
Return values
$this —clearAllHeaders()
Remove all headers from a Swift message.
protected
clearAllHeaders(Swift_Message $message) : mixed
Parameters
- $message : Swift_Message
Return values
mixed —copyFromOpenSSLOutput()
protected
copyFromOpenSSLOutput(Swift_OutputByteStream $fromStream, Swift_InputByteStream $toStream) : mixed
Parameters
- $fromStream : Swift_OutputByteStream
- $toStream : Swift_InputByteStream
Return values
mixed —copyHeader()
Copy a single header from one Swift message to another.
protected
copyHeader(Swift_Message $fromMessage, Swift_Message $toMessage, string $headerName) : mixed
Parameters
- $fromMessage : Swift_Message
- $toMessage : Swift_Message
- $headerName : string
Return values
mixed —copyHeaders()
Copy named headers from one Swift message to another.
protected
copyHeaders(Swift_Message $fromMessage, Swift_Message $toMessage[, array<string|int, mixed> $headers = [] ]) : mixed
Parameters
- $fromMessage : Swift_Message
- $toMessage : Swift_Message
- $headers : array<string|int, mixed> = []
Return values
mixed —parseSSLOutput()
protected
parseSSLOutput(Swift_InputByteStream $inputStream, Swift_Message $message) : mixed
Parameters
- $inputStream : Swift_InputByteStream
- $message : Swift_Message
Return values
mixed —parseStream()
This message will parse the headers of a MIME email byte stream and return an array that contains the headers as an associative array and the email body as a string.
protected
parseStream(Swift_OutputByteStream $emailStream) : array<string|int, mixed>
Parameters
- $emailStream : Swift_OutputByteStream
Return values
array<string|int, mixed> —smimeEncryptMessage()
Encrypt a Swift message.
protected
smimeEncryptMessage(Swift_Message $message) : mixed
Parameters
- $message : Swift_Message
Return values
mixed —smimeSignMessage()
Sign a Swift message.
protected
smimeSignMessage(Swift_Message $message) : mixed
Parameters
- $message : Swift_Message
Return values
mixed —streamToMime()
Merges an OutputByteStream from OpenSSL to a Swift_Message.
protected
streamToMime(Swift_OutputByteStream $fromStream, Swift_Message $message) : mixed
Parameters
- $fromStream : Swift_OutputByteStream
- $message : Swift_Message
Return values
mixed —wrapMimeMessage()
Wraps a Swift_Message in a message/rfc822 MIME part.
protected
wrapMimeMessage(Swift_Message $message) : Swift_MimePart
Parameters
- $message : Swift_Message