PHP Class Swift_Signers_SMimeSigner, Halite

Author: Romain-Geissler
Author: Sebastiaan Stok ([email protected])
Inheritance: implements Swift_Signers_BodySigner
Exibir arquivo Open project: HaliteChallenge/Halite Class Usage Examples

Protected Properties

Property Type Description
$encryptCert
$encryptCipher
$encryptLevel
$encryptOptions
$extraCerts
$headerFactory Swift_Mime_HeaderFactory
$replacementFactory Swift_StreamFilters_StringReplacementFilterFactory
$signCertificate
$signLevel
$signOptions
$signPrivateKey
$signThenEncrypt

Public Methods

Method Description
__construct ( string | null $signCertificate = null, string | null $signPrivateKey = null, string | null $encryptCertificate = null ) Constructor.
getAlteredHeaders ( ) : array Return the list of header a signer might tamper.
getSignCertificate ( ) : string
getSignPrivateKey ( ) : string
isSignThenEncrypt ( ) : boolean
newInstance ( string $certificate = null, string $privateKey = null ) : Swift_Signers_SMimeSigner Returns an new Swift_Signers_SMimeSigner instance.
reset ( ) : Swift_Signers_SMimeSigner Resets internal states.
setEncryptCertificate ( string | array $recipientCerts, integer $cipher = null ) : Swift_Signers_SMimeSigner Set the certificate location to use for encryption.
setSignCertificate ( string $certificate, string | array $privateKey = null, integer $signOptions = PKCS7_DETACHED, string $extraCerts = null ) : Swift_Signers_SMimeSigner Set the certificate location to use for signing.
setSignThenEncrypt ( boolean $signThenEncrypt = true ) : Swift_Signers_SMimeSigner Set perform signing before encryption.
signMessage ( Swift_Message $message ) : Swift_Signers_SMimeSigner Change the Swift_Message to apply the signing.

Protected Methods

Method Description
copyFromOpenSSLOutput ( Swift_OutputByteStream $fromStream, Swift_InputByteStream $toStream )
createMessage ( Swift_Message $message ) : Swift_Message
messageStreamToEncryptedByteStream ( Swift_FileStream $outputStream, Swift_InputByteStream $is )
messageStreamToSignedByteStream ( Swift_FileStream $outputStream, Swift_InputByteStream $inputStream )
streamToMime ( Swift_OutputByteStream $fromStream, Swift_Message $message ) Merges an OutputByteStream to Swift_Message.
toSMimeByteStream ( Swift_InputByteStream $inputStream, Swift_Message $message )

Method Details

__construct() public method

Constructor.
public __construct ( string | null $signCertificate = null, string | null $signPrivateKey = null, string | null $encryptCertificate = null )
$signCertificate string | null
$signPrivateKey string | null
$encryptCertificate string | null

copyFromOpenSSLOutput() protected method

protected copyFromOpenSSLOutput ( Swift_OutputByteStream $fromStream, Swift_InputByteStream $toStream )
$fromStream Swift_OutputByteStream
$toStream Swift_InputByteStream

createMessage() protected method

protected createMessage ( Swift_Message $message ) : Swift_Message
$message Swift_Message
return Swift_Message

getAlteredHeaders() public method

Return the list of header a signer might tamper.
public getAlteredHeaders ( ) : array
return array

getSignCertificate() public method

public getSignCertificate ( ) : string
return string

getSignPrivateKey() public method

public getSignPrivateKey ( ) : string
return string

isSignThenEncrypt() public method

public isSignThenEncrypt ( ) : boolean
return boolean

messageStreamToEncryptedByteStream() protected method

protected messageStreamToEncryptedByteStream ( Swift_FileStream $outputStream, Swift_InputByteStream $is )
$outputStream Swift_FileStream
$is Swift_InputByteStream

messageStreamToSignedByteStream() protected method

protected messageStreamToSignedByteStream ( Swift_FileStream $outputStream, Swift_InputByteStream $inputStream )
$outputStream Swift_FileStream
$inputStream Swift_InputByteStream

newInstance() public static method

Returns an new Swift_Signers_SMimeSigner instance.
public static newInstance ( string $certificate = null, string $privateKey = null ) : Swift_Signers_SMimeSigner
$certificate string
$privateKey string
return Swift_Signers_SMimeSigner

reset() public method

Resets internal states.
public reset ( ) : Swift_Signers_SMimeSigner
return Swift_Signers_SMimeSigner

setEncryptCertificate() public method

Set the certificate location to use for encryption.
public setEncryptCertificate ( string | array $recipientCerts, integer $cipher = null ) : Swift_Signers_SMimeSigner
$recipientCerts string | array Either an single X.509 certificate, or an assoc array of X.509 certificates.
$cipher integer
return Swift_Signers_SMimeSigner

setSignCertificate() public method

Set the certificate location to use for signing.
public setSignCertificate ( string $certificate, string | array $privateKey = null, integer $signOptions = PKCS7_DETACHED, string $extraCerts = null ) : Swift_Signers_SMimeSigner
$certificate string
$privateKey string | array If the key needs an passphrase use array('file-location', 'passphrase') instead
$signOptions integer Bitwise operator options for openssl_pkcs7_sign()
$extraCerts string A file containing intermediate certificates needed by the signing certificate
return Swift_Signers_SMimeSigner

setSignThenEncrypt() public method

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 setSignThenEncrypt ( boolean $signThenEncrypt = true ) : Swift_Signers_SMimeSigner
$signThenEncrypt boolean
return Swift_Signers_SMimeSigner

signMessage() public method

Change the Swift_Message to apply the signing.
public signMessage ( Swift_Message $message ) : Swift_Signers_SMimeSigner
$message Swift_Message
return Swift_Signers_SMimeSigner

streamToMime() protected method

Merges an OutputByteStream to Swift_Message.
protected streamToMime ( Swift_OutputByteStream $fromStream, Swift_Message $message )
$fromStream Swift_OutputByteStream
$message Swift_Message

toSMimeByteStream() protected method

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

Property Details

$encryptCert protected_oe property

protected $encryptCert

$encryptCipher protected_oe property

protected $encryptCipher

$encryptLevel protected_oe property

protected $encryptLevel

$encryptOptions protected_oe property

protected $encryptOptions

$extraCerts protected_oe property

protected $extraCerts

$headerFactory protected_oe property

protected Swift_Mime_HeaderFactory $headerFactory
return Swift_Mime_HeaderFactory

$replacementFactory protected_oe property

protected Swift_StreamFilters_StringReplacementFilterFactory $replacementFactory
return Swift_StreamFilters_StringReplacementFilterFactory

$signCertificate protected_oe property

protected $signCertificate

$signLevel protected_oe property

protected $signLevel

$signOptions protected_oe property

protected $signOptions

$signPrivateKey protected_oe property

protected $signPrivateKey

$signThenEncrypt protected_oe property

protected $signThenEncrypt