PHP Class Swift_Signers_DKIMSigner

Author: Xavier De Cock ([email protected])
Inheritance: implements Swift_Signers_HeaderSigner
Show file Open project: swiftmailer/swiftmailer Class Usage Examples

Protected Properties

Property Type Description
$bodyCanon string Body canon method.
$bodyLen integer BodyLength.
$debugHeaders boolean Must we embed signed headers?
$dkimHeader Swift_Mime_Headers_ParameterizedHeader Stores the signature header.
$domainName string DomainName.
$hashAlgorithm string Hash algorithm used.
$headerCanon string Header canon method.
$ignoredHeaders array Headers not being signed.
$maxLen integer Maximum signedLen.
$privateKey string PrivateKey.
$selector string Selector.
$showLen boolean Embbed bodyLen in signature.
$signatureExpiration integer When will the signature expires false means not embedded, if sigTimestamp is auto Expiration is relative, otherwhise it's absolute.
$signatureTimestamp mixed When the signature has been applied (true means time()), false means not embedded.
$signedHeaders array Headers used to generate hash.
$signerIdentity string Signer identity.

Public Methods

Method Description
__construct ( string $privateKey, string $domainName, string $selector ) Constructor.
addSignature ( Swift_Mime_HeaderSet $headers ) : Swift_Signers_DKIMSigner Add the signature to the given Headers.
bind ( Swift_InputByteStream $is ) Attach $is to this stream.
commit ( ) For any bytes that are currently buffered inside the stream, force them off the buffer.
endBody ( ) End Body.
flushBuffers ( ) Flush the contents of the stream (empty it) and set the internal pointer to the beginning.
getAlteredHeaders ( ) : array Returns the list of Headers Tampered by this plugin.
ignoreHeader ( string $header_name ) : Swift_Signers_DKIMSigner Adds an ignored Header.
reset ( ) Reset the Signer.
setBodyCanon ( string $canon ) : Swift_Signers_DKIMSigner Set the body canonicalization algorithm.
setBodySignedLen ( mixed $len ) : Swift_Signers_DKIMSigner Set the length of the body to sign.
setDebugHeaders ( boolean $debug ) : Swift_Signers_DKIMSigner Enable / disable the DebugHeaders.
setHashAlgorithm ( string $hash ) : Swift_Signers_DKIMSigner Set hash_algorithm, must be one of rsa-sha256 | rsa-sha1 defaults to rsa-sha256.
setHeaderCanon ( string $canon ) : Swift_Signers_DKIMSigner Set the header canonicalization algorithm.
setHeaders ( Swift_Mime_HeaderSet $headers ) : Swift_Signers_DKIMSigner Set the headers to sign.
setSignatureExpiration ( integer $time ) : Swift_Signers_DKIMSigner Set the signature expiration timestamp.
setSignatureTimestamp ( integer $time ) : Swift_Signers_DKIMSigner Set the signature timestamp.
setSignerIdentity ( string $identity ) : Swift_Signers_DKIMSigner Set the signer identity.
startBody ( ) Start Body.
unbind ( Swift_InputByteStream $is ) Remove an already bound stream.
write ( string $bytes ) : integer Writes $bytes to the end of the stream.

Protected Methods

Method Description
addHeader ( $header, $is_sig = false ) * Private helpers
canonicalizeBody ( $string )
endOfBody ( )

Private Methods

Method Description
addToBodyHash ( $string )
addToHeaderHash ( $header )
getEncryptedHash ( ) : string

Method Details

__construct() public method

Constructor.
public __construct ( string $privateKey, string $domainName, string $selector )
$privateKey string
$domainName string
$selector string

addHeader() protected method

* Private helpers
protected addHeader ( $header, $is_sig = false )

addSignature() public method

Add the signature to the given Headers.
public addSignature ( Swift_Mime_HeaderSet $headers ) : Swift_Signers_DKIMSigner
$headers Swift_Mime_HeaderSet
return Swift_Signers_DKIMSigner

bind() public method

The stream acts as an observer, receiving all data that is written. All {@link write()} and {@link flushBuffers()} operations will be mirrored.
public bind ( Swift_InputByteStream $is )
$is Swift_InputByteStream

canonicalizeBody() protected method

protected canonicalizeBody ( $string )

commit() public method

For any bytes that are currently buffered inside the stream, force them off the buffer.
public commit ( )

endBody() public method

End Body.
public endBody ( )

endOfBody() protected method

protected endOfBody ( )

flushBuffers() public method

Flush the contents of the stream (empty it) and set the internal pointer to the beginning.
public flushBuffers ( )

getAlteredHeaders() public method

Returns the list of Headers Tampered by this plugin.
public getAlteredHeaders ( ) : array
return array

ignoreHeader() public method

Adds an ignored Header.
public ignoreHeader ( string $header_name ) : Swift_Signers_DKIMSigner
$header_name string
return Swift_Signers_DKIMSigner

reset() public method

Reset the Signer.
See also: Swift_Signer::reset()
public reset ( )

setBodyCanon() public method

Set the body canonicalization algorithm.
public setBodyCanon ( string $canon ) : Swift_Signers_DKIMSigner
$canon string
return Swift_Signers_DKIMSigner

setBodySignedLen() public method

Set the length of the body to sign.
public setBodySignedLen ( mixed $len ) : Swift_Signers_DKIMSigner
$len mixed (bool or int)
return Swift_Signers_DKIMSigner

setDebugHeaders() public method

Enable / disable the DebugHeaders.
public setDebugHeaders ( boolean $debug ) : Swift_Signers_DKIMSigner
$debug boolean
return Swift_Signers_DKIMSigner

setHashAlgorithm() public method

Set hash_algorithm, must be one of rsa-sha256 | rsa-sha1 defaults to rsa-sha256.
public setHashAlgorithm ( string $hash ) : Swift_Signers_DKIMSigner
$hash string
return Swift_Signers_DKIMSigner

setHeaderCanon() public method

Set the header canonicalization algorithm.
public setHeaderCanon ( string $canon ) : Swift_Signers_DKIMSigner
$canon string
return Swift_Signers_DKIMSigner

setHeaders() public method

Set the headers to sign.
public setHeaders ( Swift_Mime_HeaderSet $headers ) : Swift_Signers_DKIMSigner
$headers Swift_Mime_HeaderSet
return Swift_Signers_DKIMSigner

setSignatureExpiration() public method

Set the signature expiration timestamp.
public setSignatureExpiration ( integer $time ) : Swift_Signers_DKIMSigner
$time integer A timestamp
return Swift_Signers_DKIMSigner

setSignatureTimestamp() public method

Set the signature timestamp.
public setSignatureTimestamp ( integer $time ) : Swift_Signers_DKIMSigner
$time integer A timestamp
return Swift_Signers_DKIMSigner

setSignerIdentity() public method

Set the signer identity.
public setSignerIdentity ( string $identity ) : Swift_Signers_DKIMSigner
$identity string
return Swift_Signers_DKIMSigner

startBody() public method

Start Body.
public startBody ( )

unbind() public method

If $is is not bound, no errors will be raised. If the stream currently has any buffered data it will be written to $is before unbinding occurs.
public unbind ( Swift_InputByteStream $is )
$is Swift_InputByteStream

write() public method

Writing may not happen immediately if the stream chooses to buffer. If you want to write these bytes with immediate effect, call {@link commit()} after calling write(). This method returns the sequence ID of the write (i.e. 1 for first, 2 for second, etc etc).
public write ( string $bytes ) : integer
$bytes string
return integer

Property Details

$bodyCanon protected property

Body canon method.
protected string $bodyCanon
return string

$bodyLen protected property

BodyLength.
protected int $bodyLen
return integer

$debugHeaders protected property

Must we embed signed headers?
protected bool $debugHeaders
return boolean

$dkimHeader protected property

Stores the signature header.
protected Swift_Mime_Headers_ParameterizedHeader $dkimHeader
return Swift_Mime_Headers_ParameterizedHeader

$domainName protected property

DomainName.
protected string $domainName
return string

$hashAlgorithm protected property

Hash algorithm used.
protected string $hashAlgorithm
return string

$headerCanon protected property

Header canon method.
protected string $headerCanon
return string

$ignoredHeaders protected property

Headers not being signed.
protected array $ignoredHeaders
return array

$maxLen protected property

Maximum signedLen.
protected int $maxLen
return integer

$privateKey protected property

PrivateKey.
protected string $privateKey
return string

$selector protected property

Selector.
protected string $selector
return string

$showLen protected property

Embbed bodyLen in signature.
protected bool $showLen
return boolean

$signatureExpiration protected property

When will the signature expires false means not embedded, if sigTimestamp is auto Expiration is relative, otherwhise it's absolute.
protected int $signatureExpiration
return integer

$signatureTimestamp protected property

When the signature has been applied (true means time()), false means not embedded.
protected mixed $signatureTimestamp
return mixed

$signedHeaders protected property

Headers used to generate hash.
protected array $signedHeaders
return array

$signerIdentity protected property

Signer identity.
protected string $signerIdentity
return string