NTLMAuthenticator
in package
implements
AuthInterface
NTLM Auth class
Tags
Table of Contents
Interfaces
- AuthInterface
- SMTP authenticator interface
Constants
Methods
- 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
- Create blob method
- createByte() : string
- Right padding with 0 to certain length
- createDesKey() : string
- Create DES key
- 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
- Debug method
- 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
- getRandomBytes() : string
- Create random bytes
- hex2bin() : string
- Hex2bin replacement for < PHP 5.4
- 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() : null|string
- si2bin method
- uRShift() : int
- Java unsigned right bitwise $a >>> $b
Constants
DESCONST
public
mixed
DESCONST
= 'KGS!@#$%'
NTLMSIG
NTLM constants
public
mixed
NTLMSIG
= "NTLMSSP\x00"
Methods
authenticate()
Try to authenticate the user with $username and $password
public
authenticate(AgentInterface $agent, string $username, string $password) : bool
Parameters
- $agent : AgentInterface
- $username : string
- $password : string
Tags
Return values
boolgetAuthKeyword()
Get the name of the AUTH mechanism this Authenticator handles
public
getAuthKeyword() : string
Return values
stringcastToByte()
Cast to byte java equivalent to (byte)
protected
castToByte(int $v) : int
Parameters
- $v : int
Return values
intconvertTo16bit()
Convert UTF-8 to UTF-16
protected
convertTo16bit(string $input) : string
Parameters
- $input : string
Return values
stringcreateBlob()
Create blob method
protected
createBlob(string $timestamp, string $client, string $targetInfo) : string
Parameters
- $timestamp : string
-
Epoch timestamp in microseconds
- $client : string
-
Random bytes
- $targetInfo : string
Return values
stringcreateByte()
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
stringcreateDesKey()
Create DES key
protected
createDesKey(mixed $key) : string
Parameters
- $key : mixed
Return values
stringcreateLMPassword()
Create LMv1 response
protected
createLMPassword(string $password, string $challenge) : string
Parameters
- $password : string
- $challenge : string
Return values
stringcreateLMv2Password()
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
stringcreateMessage1()
Create our message 1
protected
createMessage1() : string
Return values
stringcreateMessage3()
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
stringcreateNTLMPassword()
Create NTLMv1 response
protected
createNTLMPassword(string $password, string $challenge) : string
Parameters
- $password : string
- $challenge : string
Return values
stringcreateNTLMv2Hash()
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
Return values
stringcreateSecurityBuffer()
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
stringdebug()
Debug method
protected
debug(string $message) : mixed
Parameters
- $message : string
desEncrypt()
DES Encryption
protected
desEncrypt(string $value, string $key) : string
Parameters
- $value : string
-
An 8-byte string
- $key : string
Return values
stringgetCorrectTimestamp()
Convert a normal timestamp to a tenth of a microtime epoch time
protected
getCorrectTimestamp(string $time) : string
Parameters
- $time : string
Return values
stringgetDomainAndUsername()
Get domain and username from our username
protected
getDomainAndUsername(string $name) : array<string|int, mixed>
Parameters
- $name : string
Tags
Return values
array<string|int, mixed>getRandomBytes()
Create random bytes
protected
getRandomBytes(mixed $length) : string
Parameters
- $length : mixed
Return values
stringhex2bin()
Hex2bin replacement for < PHP 5.4
protected
hex2bin(string $hex) : string
Parameters
- $hex : string
Return values
string —Binary
md4Encrypt()
MD4 Encryption
protected
md4Encrypt(string $input) : string
Parameters
- $input : string
Tags
Return values
stringmd5Encrypt()
MD5 Encryption
protected
md5Encrypt(string $key, string $msg) : string
Parameters
- $key : string
-
Encryption key
- $msg : string
-
Message to encrypt
Return values
stringparseMessage2()
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>sendMessage1()
Send our auth message and returns the response
protected
sendMessage1(AgentInterface $agent) : string
Parameters
- $agent : AgentInterface
Return values
string —SMTP Response
sendMessage3()
Send our final message with all our data
protected
sendMessage3(string $response, string $username, string $password, string $timestamp, string $client, AgentInterface $agent[, bool $v2 = true ]) : string
Parameters
- $response : string
-
Message 1 response (message 2)
- $username : string
- $password : string
- $timestamp : string
- $client : string
- $agent : AgentInterface
- $v2 : bool = true
-
Use version2 of the protocol
Return values
stringsi2bin()
si2bin method
protected
si2bin(mixed $si[, int $bits = 32 ]) : null|string
Parameters
- $si : mixed
- $bits : int = 32
Return values
null|stringuRShift()
Java unsigned right bitwise $a >>> $b
protected
uRShift(int $a, int $b) : int
Parameters
- $a : int
- $b : int