Class Swift_Signers_SMimeSigner

InheritanceSwift_Signers_SMimeSigner
ImplementsSwift_Signers_BodySigner

MIME Message Signer used to apply S/MIME Signature/Encryption to a message.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Constructor. Swift_Signers_SMimeSigner
getAlteredHeaders() Return the list of header a signer might tamper. Swift_Signers_SMimeSigner
getSignCertificate() Swift_Signers_SMimeSigner
getSignPrivateKey() Swift_Signers_SMimeSigner
isSignThenEncrypt() Swift_Signers_SMimeSigner
newInstance() Returns an new Swift_Signers_SMimeSigner instance. Swift_Signers_SMimeSigner
reset() Resets internal states. Swift_Signers_SMimeSigner
setEncryptCertificate() Set the certificate location to use for encryption. Swift_Signers_SMimeSigner
setSignCertificate() Set the certificate location to use for signing. Swift_Signers_SMimeSigner
setSignThenEncrypt() Set perform signing before encryption. Swift_Signers_SMimeSigner
signMessage() Change the Swift_Message to apply the signing. Swift_Signers_SMimeSigner

Property Details

$encryptCert protected property
protected $encryptCert null
$encryptCipher protected property
protected $encryptCipher null
$encryptLevel protected property
protected $encryptLevel null
$encryptOptions protected property
protected $encryptOptions null
$extraCerts protected property
protected $extraCerts null
$headerFactory protected property
$replacementFactory protected property
$signCertificate protected property
protected $signCertificate null
$signLevel protected property
protected $signLevel null
$signOptions protected property
protected $signOptions null
$signPrivateKey protected property
protected $signPrivateKey null
$signThenEncrypt protected property
protected $signThenEncrypt true

Method Details

__construct() public method

Constructor.

public void __construct ( $signCertificate null, $signPrivateKey null, $encryptCertificate null )
$signCertificate
$signPrivateKey
$encryptCertificate string
copyFromOpenSSLOutput() protected method

protected void copyFromOpenSSLOutput ( Swift_OutputByteStream $fromStream, Swift_InputByteStream $toStream )
$fromStream Swift_OutputByteStream
$toStream Swift_InputByteStream
createMessage() protected method

protected Swift_Message createMessage ( Swift_Message $message )
$message Swift_Message
getAlteredHeaders() public method

Return the list of header a signer might tamper.

public array getAlteredHeaders ( )
getSignCertificate() public method

public string getSignCertificate ( )
getSignPrivateKey() public method

public string getSignPrivateKey ( )
isSignThenEncrypt() public method

public bool isSignThenEncrypt ( )
messageStreamToEncryptedByteStream() protected method

protected void messageStreamToEncryptedByteStream ( Swift_FileStream $outputStream, Swift_InputByteStream $is )
$outputStream Swift_FileStream
$is Swift_InputByteStream
throws Swift_IoException
messageStreamToSignedByteStream() protected method

protected void messageStreamToSignedByteStream ( Swift_FileStream $outputStream, Swift_InputByteStream $inputStream )
$outputStream Swift_FileStream
$inputStream Swift_InputByteStream
throws Swift_IoException
newInstance() public static method

Returns an new Swift_Signers_SMimeSigner instance.

public static Swift_Signers_SMimeSigner newInstance ( $certificate null, $privateKey null )
$certificate string
$privateKey string
reset() public method

Resets internal states.

public Swift_Signers_SMimeSigner reset ( )
setEncryptCertificate() public method

Set the certificate location to use for encryption.

public Swift_Signers_SMimeSigner setEncryptCertificate ( $recipientCerts, $cipher null )
$recipientCerts string|array

Either an single X.509 certificate, or an assoc array of X.509 certificates.

$cipher int
setSignCertificate() public method

Set the certificate location to use for signing.

public Swift_Signers_SMimeSigner setSignCertificate ( $certificate, $privateKey null, $signOptions PKCS7_DETACHED, $extraCerts null )
$certificate string
$privateKey string|array

If the key needs an passphrase use array('file-location', 'passphrase') instead

$signOptions int

Bitwise operator options for openssl_pkcs7_sign()

$extraCerts string

A file containing intermediate certificates needed by the signing certificate

setSignThenEncrypt() public method

Set perform signing before encryption.

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.

public Swift_Signers_SMimeSigner setSignThenEncrypt ( $signThenEncrypt true )
$signThenEncrypt string
signMessage() public method

Change the Swift_Message to apply the signing.

public Swift_Signers_SMimeSigner signMessage ( Swift_Message $message )
$message Swift_Message
streamToMime() protected method

Merges an OutputByteStream to Swift_Message.

protected void streamToMime ( Swift_OutputByteStream $fromStream, Swift_Message $message )
$fromStream Swift_OutputByteStream
$message Swift_Message
toSMimeByteStream() protected method

protected void toSMimeByteStream ( Swift_InputByteStream $inputStream, Swift_Message $message )
$inputStream Swift_InputByteStream
$message