PHP Class Swift_Transport_Esmtp_Auth_NTLMAuthenticator

Author: Ward Peeters ([email protected])
Inheritance: implements Swift_Transport_Esmtp_Authenticator
Datei anzeigen Open project: swiftmailer/swiftmailer

Public Methods

Method Description
authenticate ( Swift_Transport_SmtpAgent $agent, string $username, string $password ) : boolean Try to authenticate the user with $username and $password.
getAuthKeyword ( ) : string Get the name of the AUTH mechanism this Authenticator handles.

Protected Methods

Method Description
castToByte ( integer $v ) : integer Cast to byte java equivalent to (byte).
convertTo16bit ( string $input ) : string Convert UTF-8 to UTF-16.
createBlob ( string $timestamp, string $client, string $targetInfo ) : string
createByte ( string $input, integer $bytes = 4, boolean $isHex = true ) : string Right padding with 0 to certain length.
createDesKey ( $key )
createLMPassword ( string $password, string $challenge ) : string Create LMv1 response.
createLMv2Password ( string $password, string $username, string $domain, string $challenge, string $client ) : string Create LMv2 response.
createMessage1 ( ) : string Create our message 1.
createMessage3 ( string $domain, string $username, string $workstation, string $lmResponse, string $ntlmResponse ) : string Create our message 3.
createNTLMPassword ( string $password, string $challenge ) : string Create NTLMv1 response.
createNTLMv2Hash ( string $password, string $username, string $domain, string $challenge, string $targetInfo, string $timestamp, string $client ) : string Create NTLMv2 response.
createSecurityBuffer ( string $value, integer $offset, boolean $is16 = false ) : string Create our security buffer depending on length and offset.
debug ( string $message )
desEncrypt ( string $value, string $key ) : string DES Encryption.
getCorrectTimestamp ( string $time ) : string Convert a normal timestamp to a tenth of a microtime epoch time.
getDomainAndUsername ( string $name ) : array Get domain and username from our username.
getRandomBytes ( $length ) : string Create random bytes.
md4Encrypt ( string $input ) : string MD4 Encryption.
md5Encrypt ( string $key, string $msg ) : string MD5 Encryption.
parseMessage2 ( string $response ) : array Fetch all details of our response (message 2).
readSecurityBuffer ( string $value ) : array Read our security buffer to fetch length and offset of our value.
readSubBlock ( $block ) : array Read the blob information in from message2.
sendMessage1 ( Swift_Transport_SmtpAgent $agent ) : string Send our auth message and returns the response.
sendMessage3 ( string $response, string $username, string $password, string $timestamp, string $client, Swift_Transport_SmtpAgent $agent, boolean $v2 = true ) : string Send our final message with all our data.
si2bin ( $si, $bits = 32 )
uRShift ( integer $a, integer $b ) : integer Java unsigned right bitwise $a >>> $b.

Method Details

authenticate() public method

Try to authenticate the user with $username and $password.
public authenticate ( Swift_Transport_SmtpAgent $agent, string $username, string $password ) : boolean
$agent Swift_Transport_SmtpAgent
$username string
$password string
return boolean

castToByte() protected method

Cast to byte java equivalent to (byte).
protected castToByte ( integer $v ) : integer
$v integer
return integer

convertTo16bit() protected method

Convert UTF-8 to UTF-16.
protected convertTo16bit ( string $input ) : string
$input string
return string

createBlob() protected method

protected createBlob ( string $timestamp, string $client, string $targetInfo ) : string
$timestamp string Epoch timestamp in microseconds
$client string Random bytes
$targetInfo string
return string

createByte() protected method

Right padding with 0 to certain length.
protected createByte ( string $input, integer $bytes = 4, boolean $isHex = true ) : string
$input string
$bytes integer Length of bytes
$isHex boolean Did we provided hex value
return string

createDesKey() protected method

protected createDesKey ( $key )

createLMPassword() protected method

Create LMv1 response.
protected createLMPassword ( string $password, string $challenge ) : string
$password string
$challenge string
return string

createLMv2Password() protected method

Create LMv2 response.
protected createLMv2Password ( string $password, string $username, string $domain, string $challenge, string $client ) : string
$password string
$username string
$domain string
$challenge string NTLM Challenge
$client string Random string
return string

createMessage1() protected method

Create our message 1.
protected createMessage1 ( ) : string
return string

createMessage3() protected method

Create our message 3.
protected createMessage3 ( string $domain, string $username, string $workstation, string $lmResponse, string $ntlmResponse ) : string
$domain string
$username string
$workstation string
$lmResponse string
$ntlmResponse string
return string

createNTLMPassword() protected method

Create NTLMv1 response.
protected createNTLMPassword ( string $password, string $challenge ) : string
$password string
$challenge string
return string

createNTLMv2Hash() protected method

Create NTLMv2 response.
See also: http://davenport.sourceforge.net/ntlm.html#theNtlmResponse
protected createNTLMv2Hash ( string $password, string $username, string $domain, string $challenge, string $targetInfo, string $timestamp, string $client ) : string
$password string
$username string
$domain string
$challenge string Hex values
$targetInfo string Hex values
$timestamp string
$client string Random bytes
return string

createSecurityBuffer() protected method

Create our security buffer depending on length and offset.
protected createSecurityBuffer ( string $value, integer $offset, boolean $is16 = false ) : string
$value string Value we want to put in
$offset integer start of value
$is16 boolean Do we 16bit string or not?
return string

debug() protected method

protected debug ( string $message )
$message string

desEncrypt() protected method

DES Encryption.
protected desEncrypt ( string $value, string $key ) : string
$value string An 8-byte string
$key string
return string

getAuthKeyword() public method

Get the name of the AUTH mechanism this Authenticator handles.
public getAuthKeyword ( ) : string
return string

getCorrectTimestamp() protected method

Convert a normal timestamp to a tenth of a microtime epoch time.
protected getCorrectTimestamp ( string $time ) : string
$time string
return string

getDomainAndUsername() protected method

Get domain and username from our username.
protected getDomainAndUsername ( string $name ) : array
$name string
return array

getRandomBytes() protected method

Create random bytes.
protected getRandomBytes ( $length ) : string
$length
return string

md4Encrypt() protected method

MD4 Encryption.
See also: http://php.net/manual/en/ref.hash.php
protected md4Encrypt ( string $input ) : string
$input string
return string

md5Encrypt() protected method

MD5 Encryption.
protected md5Encrypt ( string $key, string $msg ) : string
$key string Encryption key
$msg string Message to encrypt
return string

parseMessage2() protected method

Fetch all details of our response (message 2).
protected parseMessage2 ( string $response ) : array
$response string
return array our response parsed

readSecurityBuffer() protected method

Read our security buffer to fetch length and offset of our value.
protected readSecurityBuffer ( string $value ) : array
$value string Securitybuffer in hex
return array array with length and offset

readSubBlock() protected method

Read the blob information in from message2.
protected readSubBlock ( $block ) : array
$block
return array

sendMessage1() protected method

Send our auth message and returns the response.
protected sendMessage1 ( Swift_Transport_SmtpAgent $agent ) : string
$agent Swift_Transport_SmtpAgent
return string SMTP Response

sendMessage3() protected method

Send our final message with all our data.
protected sendMessage3 ( string $response, string $username, string $password, string $timestamp, string $client, Swift_Transport_SmtpAgent $agent, boolean $v2 = true ) : string
$response string Message 1 response (message 2)
$username string
$password string
$timestamp string
$client string
$agent Swift_Transport_SmtpAgent
$v2 boolean Use version2 of the protocol
return string

si2bin() protected method

protected si2bin ( $si, $bits = 32 )

uRShift() protected method

Java unsigned right bitwise $a >>> $b.
protected uRShift ( integer $a, integer $b ) : integer
$a integer
$b integer
return integer