Documentation

Swift_Transport_Esmtp_Auth_NTLMAuthenticator
in package
implements Swift_Transport_Esmtp_Authenticator

Handles NTLM authentication.

Tags
author

Ward Peeters ward@coding-tech.com

Interfaces, Classes and Traits

Swift_Transport_Esmtp_Authenticator
An Authentication mechanism.

Table of Contents

DESCONST  = 'KGS!@#$%'
NTLMSIG  = "NTLMSSP"
authenticate()  : bool
Try to authenticate the user with $username and $password.
getAuthKeyword()  : string
Get the name of the AUTH mechanism this Authenticator handles.
castToByte()  : int
Cast to byte java equivalent to (byte).
convertTo16bit()  : string
Convert UTF-8 to UTF-16.
createBlob()  : string
createByte()  : string
Right padding with 0 to certain length.
createDesKey()  : mixed
createLMPassword()  : string
Create LMv1 response.
createLMv2Password()  : string
Create LMv2 response.
createMessage1()  : string
Create our message 1.
createMessage3()  : string
Create our message 3.
createNTLMPassword()  : string
Create NTLMv1 response.
createNTLMv2Hash()  : string
Create NTLMv2 response.
createSecurityBuffer()  : string
Create our security buffer depending on length and offset.
debug()  : mixed
desEncrypt()  : string
DES Encryption.
getCorrectTimestamp()  : string
Convert a normal timestamp to a tenth of a microtime epoch time.
getDomainAndUsername()  : array<string|int, mixed>
Get domain and username from our username.
md4Encrypt()  : string
MD4 Encryption.
md5Encrypt()  : string
MD5 Encryption.
parseMessage2()  : array<string|int, mixed>
Fetch all details of our response (message 2).
readSecurityBuffer()  : array<string|int, mixed>
Read our security buffer to fetch length and offset of our value.
readSubBlock()  : array<string|int, mixed>
Read the blob information in from message2.
sendMessage1()  : string
Send our auth message and returns the response.
sendMessage3()  : string
Send our final message with all our data.
si2bin()  : mixed
uRShift()  : int
Java unsigned right bitwise $a >>> $b.

Constants

Methods

authenticate()

Try to authenticate the user with $username and $password.

public authenticate(Swift_Transport_SmtpAgent $agent, mixed $username, mixed $password) : bool
Parameters
$agent : Swift_Transport_SmtpAgent
$username : mixed
$password : mixed
Tags
throws
LogicException
Return values
bool

true if authentication worked (returning false is deprecated, throw a Swift_TransportException instead)

getAuthKeyword()

Get the name of the AUTH mechanism this Authenticator handles.

public getAuthKeyword() : string
Return values
string

castToByte()

Cast to byte java equivalent to (byte).

protected castToByte(int $v) : int
Parameters
$v : int
Return values
int

convertTo16bit()

Convert UTF-8 to UTF-16.

protected convertTo16bit(string $input) : string
Parameters
$input : string
Return values
string

createBlob()

protected createBlob(string $timestamp, string $client, string $targetInfo) : string
Parameters
$timestamp : string

Epoch timestamp in microseconds

$client : string

Random bytes

$targetInfo : string
Return values
string

createByte()

Right padding with 0 to certain length.

protected createByte(string $input[, int $bytes = 4 ][, bool $isHex = true ]) : string
Parameters
$input : string
$bytes : int = 4

Length of bytes

$isHex : bool = true

Did we provided hex value

Return values
string

createDesKey()

protected createDesKey(mixed $key) : mixed
Parameters
$key : mixed
Return values
mixed

createLMPassword()

Create LMv1 response.

protected createLMPassword(string $password, string $challenge) : string
Parameters
$password : string
$challenge : string
Return values
string

createLMv2Password()

Create LMv2 response.

protected createLMv2Password(string $password, string $username, string $domain, string $challenge, string $client) : string
Parameters
$password : string
$username : string
$domain : string
$challenge : string

NTLM Challenge

$client : string

Random string

Return values
string

createMessage1()

Create our message 1.

protected createMessage1() : string
Return values
string

createMessage3()

Create our message 3.

protected createMessage3(string $domain, string $username, string $workstation, string $lmResponse, string $ntlmResponse) : string
Parameters
$domain : string
$username : string
$workstation : string
$lmResponse : string
$ntlmResponse : string
Return values
string

createNTLMPassword()

Create NTLMv1 response.

protected createNTLMPassword(string $password, string $challenge) : string
Parameters
$password : string
$challenge : string
Return values
string

createNTLMv2Hash()

Create NTLMv2 response.

protected createNTLMv2Hash(string $password, string $username, string $domain, string $challenge, string $targetInfo, string $timestamp, string $client) : string
Parameters
$password : string
$username : string
$domain : string
$challenge : string

Hex values

$targetInfo : string

Hex values

$timestamp : string
$client : string

Random bytes

Tags
see
http://davenport.sourceforge.net/ntlm.html#theNtlmResponse
Return values
string

createSecurityBuffer()

Create our security buffer depending on length and offset.

protected createSecurityBuffer(string $value, int $offset[, bool $is16 = false ]) : string
Parameters
$value : string

Value we want to put in

$offset : int

start of value

$is16 : bool = false

Do we 16bit string or not?

Return values
string

debug()

protected debug(string $message) : mixed
Parameters
$message : string
Return values
mixed

desEncrypt()

DES Encryption.

protected desEncrypt(string $value, string $key) : string
Parameters
$value : string

An 8-byte string

$key : string
Return values
string

getCorrectTimestamp()

Convert a normal timestamp to a tenth of a microtime epoch time.

protected getCorrectTimestamp(string $time) : string
Parameters
$time : string
Return values
string

getDomainAndUsername()

Get domain and username from our username.

protected getDomainAndUsername(string $name) : array<string|int, mixed>
Parameters
$name : string
Tags
example

DOMAIN\username

Return values
array<string|int, mixed>

md5Encrypt()

MD5 Encryption.

protected md5Encrypt(string $key, string $msg) : string
Parameters
$key : string

Encryption key

$msg : string

Message to encrypt

Return values
string

parseMessage2()

Fetch all details of our response (message 2).

protected parseMessage2(string $response) : array<string|int, mixed>
Parameters
$response : string
Return values
array<string|int, mixed>

our response parsed

readSecurityBuffer()

Read our security buffer to fetch length and offset of our value.

protected readSecurityBuffer(string $value) : array<string|int, mixed>
Parameters
$value : string

Securitybuffer in hex

Return values
array<string|int, mixed>

array with length and offset

readSubBlock()

Read the blob information in from message2.

protected readSubBlock(mixed $block) : array<string|int, mixed>
Parameters
$block : mixed
Return values
array<string|int, mixed>

sendMessage3()

Send our final message with all our data.

protected sendMessage3(string $response, string $username, string $password, string $timestamp, string $client, Swift_Transport_SmtpAgent $agent[, bool $v2 = true ]) : string
Parameters
$response : string

Message 1 response (message 2)

$username : string
$password : string
$timestamp : string
$client : string
$agent : Swift_Transport_SmtpAgent
$v2 : bool = true

Use version2 of the protocol

Return values
string

si2bin()

protected si2bin(mixed $si[, mixed $bits = 32 ]) : mixed
Parameters
$si : mixed
$bits : mixed = 32
Return values
mixed

uRShift()

Java unsigned right bitwise $a >>> $b.

protected uRShift(int $a, int $b) : int
Parameters
$a : int
$b : int
Return values
int

Search results