C# Class SharpCifs.Smb.NtlmPasswordAuthentication

This class stores and encrypts NTLM user credentials.
This class stores and encrypts NTLM user credentials. The default credentials are retrieved from the jcifs.smb.client.domain, jcifs.smb.client.username, and jcifs.smb.client.password properties.

Read jCIFS Exceptions and NtlmAuthenticator for related information.

Inheritance: Principal
Datei anzeigen Open project: brandonprry/Potato Class Usage Examples

Public Properties

Property Type Description
Anonymous NtlmPasswordAuthentication
additionalData Object

Public Methods

Method Description
Equals ( object obj ) : bool

Compares two NtlmPasswordAuthentication objects for equality.

Compares two NtlmPasswordAuthentication objects for equality. Two NtlmPasswordAuthentication objects are equal if their caseless domain and username fields are equal and either both hashes are external and they are equal or both internally supplied passwords are equal. If one NtlmPasswordAuthentication object has external hashes (meaning negotiated via NTLM HTTP Authentication) and the other does not they will not be equal. This is technically not correct however the server 8 byte challage would be required to compute and compare the password hashes but that it not available with this method.

GetAnsiHash ( byte challenge ) : byte[]

Computes the 24 byte ANSI password hash given the 8 byte server challenge.

Computes the 24 byte ANSI password hash given the 8 byte server challenge.

GetDomain ( ) : string

Returns the domain.

Returns the domain.

GetHashCode ( ) : int

Return the upcased username hash code.

Return the upcased username hash code.

GetLMv2Response ( byte responseKeyLm, byte serverChallenge, byte clientChallenge ) : byte[]
GetLMv2Response ( string domain, string user, string password, byte challenge, byte clientChallenge ) : byte[]

Creates the LMv2 response for the supplied information.

Creates the LMv2 response for the supplied information.

GetName ( ) : string

Return the domain and username in the format: domain\\username.

Return the domain and username in the format: domain\\username. This is equivalent to toString().

GetNtlMv2Response ( byte responseKeyNt, byte serverChallenge, byte clientChallenge, long nanos1601, byte targetInfo ) : byte[]
GetNtlm2Response ( byte nTowFv1, byte serverChallenge, byte clientChallenge ) : byte[]
GetNtlmResponse ( string password, byte challenge ) : byte[]

Generate the Unicode MD4 hash for the password associated with these credentials.

Generate the Unicode MD4 hash for the password associated with these credentials.

GetPassword ( ) : string

Returns the password in plain text or null if the raw password hashes were used to construct this NtlmPasswordAuthentication object which will be the case when NTLM HTTP Authentication is used.

Returns the password in plain text or null if the raw password hashes were used to construct this NtlmPasswordAuthentication object which will be the case when NTLM HTTP Authentication is used. There is no way to retrieve a users password in plain text unless it is supplied by the user at runtime.

GetPreNtlmResponse ( string password, byte challenge ) : byte[]

Generate the ANSI DES hash for the password associated with these credentials.

Generate the ANSI DES hash for the password associated with these credentials.

GetSigningKey ( byte challenge ) : byte[]
GetUnicodeHash ( byte challenge ) : byte[]

Computes the 24 byte Unicode password hash given the 8 byte server challenge.

Computes the 24 byte Unicode password hash given the 8 byte server challenge.

GetUserSessionKey ( byte challenge ) : byte[]

Returns the effective user session key.

Returns the effective user session key.

GetUsername ( ) : string

Returns the username.

Returns the username.

NtlmPasswordAuthentication ( string userInfo ) : System

Create an NtlmPasswordAuthentication object from the userinfo component of an SMB URL like "domain;user:pass".

Create an NtlmPasswordAuthentication object from the userinfo component of an SMB URL like "domain;user:pass". This constructor is used internally be jCIFS when parsing SMB URLs.

NtlmPasswordAuthentication ( string domain, string username, byte challenge, byte ansiHash, byte unicodeHash ) : System

Create an NtlmPasswordAuthentication object with raw password hashes.

Create an NtlmPasswordAuthentication object with raw password hashes. This is used exclusively by the jcifs.http.NtlmSsp class which is in turn used by NTLM HTTP authentication functionality.

NtlmPasswordAuthentication ( string domain, string username, string password ) : System

Create an NtlmPasswordAuthentication object from a domain, username, and password.

Create an NtlmPasswordAuthentication object from a domain, username, and password. Parameters that are null will be substituted with jcifs.smb.client.domain, jcifs.smb.client.username, jcifs.smb.client.password property values.

NtowFv1 ( string password ) : byte[]
NtowFv2 ( string domain, string username, string password ) : byte[]
ToString ( ) : string

Return the domain and username in the format: domain\\username.

Return the domain and username in the format: domain\\username. This is equivalent to getName().

Private Methods

Method Description
ComputeResponse ( byte responseKey, byte serverChallenge, byte clientData, int offset, int length ) : byte[]
E ( byte key, byte data, byte e ) : void
GetUserSessionKey ( byte challenge, byte dest, int offset ) : void

Calculates the effective user session key.

Calculates the effective user session key.

InitDefaults ( ) : void
Unescape ( string str ) : string

Method Details

Equals() public method

Compares two NtlmPasswordAuthentication objects for equality.
Compares two NtlmPasswordAuthentication objects for equality. Two NtlmPasswordAuthentication objects are equal if their caseless domain and username fields are equal and either both hashes are external and they are equal or both internally supplied passwords are equal. If one NtlmPasswordAuthentication object has external hashes (meaning negotiated via NTLM HTTP Authentication) and the other does not they will not be equal. This is technically not correct however the server 8 byte challage would be required to compute and compare the password hashes but that it not available with this method.
public Equals ( object obj ) : bool
obj object
return bool

GetAnsiHash() public method

Computes the 24 byte ANSI password hash given the 8 byte server challenge.
Computes the 24 byte ANSI password hash given the 8 byte server challenge.
public GetAnsiHash ( byte challenge ) : byte[]
challenge byte
return byte[]

GetDomain() public method

Returns the domain.
Returns the domain.
public GetDomain ( ) : string
return string

GetHashCode() public method

Return the upcased username hash code.
Return the upcased username hash code.
public GetHashCode ( ) : int
return int

GetLMv2Response() public static method

public static GetLMv2Response ( byte responseKeyLm, byte serverChallenge, byte clientChallenge ) : byte[]
responseKeyLm byte
serverChallenge byte
clientChallenge byte
return byte[]

GetLMv2Response() public static method

Creates the LMv2 response for the supplied information.
Creates the LMv2 response for the supplied information.
public static GetLMv2Response ( string domain, string user, string password, byte challenge, byte clientChallenge ) : byte[]
domain string The domain in which the username exists.
user string The username.
password string The user's password.
challenge byte The server challenge.
clientChallenge byte The client challenge (nonce).
return byte[]

GetName() public method

Return the domain and username in the format: domain\\username.
Return the domain and username in the format: domain\\username. This is equivalent to toString().
public GetName ( ) : string
return string

GetNtlMv2Response() public static method

public static GetNtlMv2Response ( byte responseKeyNt, byte serverChallenge, byte clientChallenge, long nanos1601, byte targetInfo ) : byte[]
responseKeyNt byte
serverChallenge byte
clientChallenge byte
nanos1601 long
targetInfo byte
return byte[]

GetNtlm2Response() public static method

public static GetNtlm2Response ( byte nTowFv1, byte serverChallenge, byte clientChallenge ) : byte[]
nTowFv1 byte
serverChallenge byte
clientChallenge byte
return byte[]

GetNtlmResponse() public static method

Generate the Unicode MD4 hash for the password associated with these credentials.
Generate the Unicode MD4 hash for the password associated with these credentials.
public static GetNtlmResponse ( string password, byte challenge ) : byte[]
password string
challenge byte
return byte[]

GetPassword() public method

Returns the password in plain text or null if the raw password hashes were used to construct this NtlmPasswordAuthentication object which will be the case when NTLM HTTP Authentication is used.
Returns the password in plain text or null if the raw password hashes were used to construct this NtlmPasswordAuthentication object which will be the case when NTLM HTTP Authentication is used. There is no way to retrieve a users password in plain text unless it is supplied by the user at runtime.
public GetPassword ( ) : string
return string

GetPreNtlmResponse() public static method

Generate the ANSI DES hash for the password associated with these credentials.
Generate the ANSI DES hash for the password associated with these credentials.
public static GetPreNtlmResponse ( string password, byte challenge ) : byte[]
password string
challenge byte
return byte[]

GetSigningKey() public method

public GetSigningKey ( byte challenge ) : byte[]
challenge byte
return byte[]

GetUnicodeHash() public method

Computes the 24 byte Unicode password hash given the 8 byte server challenge.
Computes the 24 byte Unicode password hash given the 8 byte server challenge.
public GetUnicodeHash ( byte challenge ) : byte[]
challenge byte
return byte[]

GetUserSessionKey() public method

Returns the effective user session key.
Returns the effective user session key.
public GetUserSessionKey ( byte challenge ) : byte[]
challenge byte The server challenge.
return byte[]

GetUsername() public method

Returns the username.
Returns the username.
public GetUsername ( ) : string
return string

NtlmPasswordAuthentication() public method

Create an NtlmPasswordAuthentication object from the userinfo component of an SMB URL like "domain;user:pass".
Create an NtlmPasswordAuthentication object from the userinfo component of an SMB URL like "domain;user:pass". This constructor is used internally be jCIFS when parsing SMB URLs.
public NtlmPasswordAuthentication ( string userInfo ) : System
userInfo string
return System

NtlmPasswordAuthentication() public method

Create an NtlmPasswordAuthentication object with raw password hashes.
Create an NtlmPasswordAuthentication object with raw password hashes. This is used exclusively by the jcifs.http.NtlmSsp class which is in turn used by NTLM HTTP authentication functionality.
public NtlmPasswordAuthentication ( string domain, string username, byte challenge, byte ansiHash, byte unicodeHash ) : System
domain string
username string
challenge byte
ansiHash byte
unicodeHash byte
return System

NtlmPasswordAuthentication() public method

Create an NtlmPasswordAuthentication object from a domain, username, and password.
Create an NtlmPasswordAuthentication object from a domain, username, and password. Parameters that are null will be substituted with jcifs.smb.client.domain, jcifs.smb.client.username, jcifs.smb.client.password property values.
public NtlmPasswordAuthentication ( string domain, string username, string password ) : System
domain string
username string
password string
return System

NtowFv1() public static method

public static NtowFv1 ( string password ) : byte[]
password string
return byte[]

NtowFv2() public static method

public static NtowFv2 ( string domain, string username, string password ) : byte[]
domain string
username string
password string
return byte[]

ToString() public method

Return the domain and username in the format: domain\\username.
Return the domain and username in the format: domain\\username. This is equivalent to getName().
public ToString ( ) : string
return string

Property Details

Anonymous public_oe static_oe property

public static NtlmPasswordAuthentication,SharpCifs.Smb Anonymous
return NtlmPasswordAuthentication

additionalData public_oe property

public Object additionalData
return Object