KNTLM

Search for usage in LXR

#include <kntlm.h>

Classes

struct  Auth
 
struct  Challenge
 
struct  Negotiate
 

Public Types

enum  AuthFlag { Force_V1 = 0x1, Force_V2 = 0x2, Add_LM = 0x4 }
 
typedef QFlags< AuthFlagAuthFlags
 
enum  Flags {
  Negotiate_Unicode = 0x00000001, Negotiate_OEM = 0x00000002, Request_Target = 0x00000004, Negotiate_Sign = 0x00000010,
  Negotiate_Seal = 0x00000020, Negotiate_Datagram_Style = 0x00000040, Negotiate_LM_Key = 0x00000080, Negotiate_Netware = 0x00000100,
  Negotiate_NTLM = 0x00000200, Negotiate_Domain_Supplied = 0x00001000, Negotiate_WS_Supplied = 0x00002000, Negotiate_Local_Call = 0x00004000,
  Negotiate_Always_Sign = 0x00008000, Target_Type_Domain = 0x00010000, Target_Type_Server = 0x00020000, Target_Type_Share = 0x00040000,
  Negotiate_NTLM2_Key = 0x00080000, Request_Init_Response = 0x00100000, Request_Accept_Response = 0x00200000, Request_NonNT_Key = 0x00400000,
  Negotiate_Target_Info = 0x00800000, Negotiate_128 = 0x20000000, Negotiate_Key_Exchange = 0x40000000, Negotiate_56 = 0x80000000
}
 

Static Public Member Functions

static bool getAuth (QByteArray &auth, const QByteArray &challenge, const QString &user, const QString &password, const QString &domain=QString(), const QString &workstation=QString(), AuthFlags authflags=Add_LM)
 
static QByteArray getLMResponse (const QString &password, const unsigned char *challenge)
 
static QByteArray getLMv2Response (const QString &target, const QString &user, const QString &password, const unsigned char *challenge)
 
static bool getNegotiate (QByteArray &negotiate, const QString &domain=QString(), const QString &workstation=QString(), quint32 flags=Negotiate_Unicode|Request_Target|Negotiate_NTLM)
 
static QByteArray getNTLMResponse (const QString &password, const unsigned char *challenge)
 
static QByteArray getNTLMv2Response (const QString &target, const QString &user, const QString &password, const QByteArray &targetInformation, const unsigned char *challenge)
 
static QByteArray lmHash (const QString &password)
 
static QByteArray lmResponse (const QByteArray &hash, const unsigned char *challenge)
 
static QByteArray lmv2Response (const QByteArray &hash, const QByteArray &clientData, const unsigned char *challenge)
 
static QByteArray ntlmHash (const QString &password)
 
static QByteArray ntlmv2Hash (const QString &target, const QString &user, const QString &password)
 

Detailed Description

KNTLM class implements the NTLM authentication protocol.

The KNTLM class is useful for creating the authentication structures which can be used for various servers which implements NTLM type authentication. A comprehensive description of the NTLM authentication protocol can be found at https://davenport.sourceforge.net/ntlm.html The class also contains methods to create the LanManager and NT (MD4) hashes of a password. This class doesn't maintain any state information, so all methods are static.

Deprecated:
Since 5.91, no known users.

Definition at line 30 of file kntlm.h.

Member Typedef Documentation

◆ AuthFlags

Stores a combination of AuthFlag values.

Definition at line 72 of file kntlm.h.

Member Enumeration Documentation

◆ AuthFlag

See also
AuthFlags

Definition at line 63 of file kntlm.h.

Member Function Documentation

◆ getAuth()

bool KNTLM::getAuth ( QByteArray auth,
const QByteArray challenge,
const QString user,
const QString password,
const QString domain = QString(),
const QString workstation = QString(),
AuthFlags  authflags = Add_LM 
)
static

Creates the type 3 message which should be sent to the server after the challenge (type 2) received.

Parameters
auth- a buffer where the Type 3 message will returned.
challenge- the Type 2 message returned by the server.
user- user's name.
password- user's password.
domain- the target domain. If left NULL (i.e. QString()), it will be extracted from the challenge. If set to an empty string (QString("")) an empty domain will be used.
workstation- the user's workstation.
authflags- AuthFlags flags that changes the response generation behavior. Force_V1 or Force_V2 forces (NT)LMv1 or (NT)LMv2 responses generation, otherwise it's autodetected from the challenge. Add_LM adds LMv1 or LMv2 responses additional to the NTLM response.
Returns
true if auth filled with the Type 3 message, false if an error occurred (challenge data invalid, NTLMv2 authentication forced, but the challenge data says no NTLMv2 supported, or no NTLM supported at all, and Add_LM not specified).
Deprecated:
Since 5.91, no known users.

Definition at line 202 of file kntlm.cpp.

◆ getLMResponse()

QByteArray KNTLM::getLMResponse ( const QString password,
const unsigned char *  challenge 
)
static

Returns the LanManager response from the password and the server challenge.

Deprecated:
Since 5.91, no known users.

Definition at line 298 of file kntlm.cpp.

◆ getLMv2Response()

QByteArray KNTLM::getLMv2Response ( const QString target,
const QString user,
const QString password,
const unsigned char *  challenge 
)
static

Calculates the LMv2 response.

Deprecated:
Since 5.91, no known users.

Definition at line 379 of file kntlm.cpp.

◆ getNegotiate()

bool KNTLM::getNegotiate ( QByteArray negotiate,
const QString domain = QString(),
const QString workstation = QString(),
quint32  flags = Negotiate_Unicode | Request_Target | Negotiate_NTLM 
)
static

Creates the initial message (type 1) which should be sent to the server.

Parameters
negotiate- a buffer where the Type 1 message will returned.
domain- the domain name which should be send with the message.
workstation- the workstation name which should be send with the message.
flags- various flags, in most cases the defaults will good.
Returns
true if creating the structure succeeds, false otherwise.
Deprecated:
Since 5.91, no known users.

Definition at line 180 of file kntlm.cpp.

◆ getNTLMResponse()

QByteArray KNTLM::getNTLMResponse ( const QString password,
const unsigned char *  challenge 
)
static

Returns the NTLM response from the password and the server challenge.

Deprecated:
Since 5.91, no known users.

Definition at line 350 of file kntlm.cpp.

◆ getNTLMv2Response()

QByteArray KNTLM::getNTLMv2Response ( const QString target,
const QString user,
const QString password,
const QByteArray targetInformation,
const unsigned char *  challenge 
)
static

Calculates the NTLMv2 response.

Deprecated:
Since 5.91, no known users.

Definition at line 368 of file kntlm.cpp.

◆ lmHash()

QByteArray KNTLM::lmHash ( const QString password)
static

Calculates the LanManager hash of the specified password.

Deprecated:
Since 5.91, no known users.

Definition at line 311 of file kntlm.cpp.

◆ lmResponse()

QByteArray KNTLM::lmResponse ( const QByteArray hash,
const unsigned char *  challenge 
)
static

Calculates the LanManager response from the LanManager hash and the server challenge.

Deprecated:
Since 5.91, no known users.

Definition at line 332 of file kntlm.cpp.

◆ lmv2Response()

QByteArray KNTLM::lmv2Response ( const QByteArray hash,
const QByteArray clientData,
const unsigned char *  challenge 
)
static

Calculates the LMv2 response.

Deprecated:
Since 5.91, no known users.

Definition at line 398 of file kntlm.cpp.

◆ ntlmHash()

QByteArray KNTLM::ntlmHash ( const QString password)
static

Returns the NTLM hash (MD4) from the password.

Deprecated:
Since 5.91, no known users.

Definition at line 360 of file kntlm.cpp.

◆ ntlmv2Hash()

QByteArray KNTLM::ntlmv2Hash ( const QString target,
const QString user,
const QString password 
)
static

Returns the NTLMv2 hash.

Deprecated:
Since 5.91, no known users.

Definition at line 391 of file kntlm.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Fri Dec 8 2023 03:51:30 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.