• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kio

KNTLM Class Reference

KNTLM class implements the NTLM authentication protocol. More...

#include <kntlm.h>

List of all members.


Classes

struct  Auth
 The NTLM Type 3 structure. More...
struct  Blob
struct  Challenge
 The NTLM Type 2 structure. More...
struct  Negotiate
 The NTLM Type 1 structure. More...
struct  SecBuf

Public Types

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 QByteArray createBlob (const QByteArray &targetinfo)
static bool getAuth (QByteArray &auth, const QByteArray &challenge, const QString &user, const QString &password, const QString &domain=QString::null, const QString &workstation=QString::null, bool forceNTLM=false, bool forceNTLMv2=false)
static QByteArray getBuf (const QByteArray &buf, const SecBuf &secbuf)
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::null, const QString &workstation=QString::null, Q_UINT32 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 QString getString (const QByteArray &buf, const SecBuf &secbuf, bool unicode)
static QByteArray hmacMD5 (const QByteArray &data, const QByteArray &key)
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 http://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.

Definition at line 41 of file kntlm.h.


Member Enumeration Documentation

enum KNTLM::Flags

Enumerator:
Negotiate_Unicode 
Negotiate_OEM 
Request_Target 
Negotiate_Sign 
Negotiate_Seal 
Negotiate_Datagram_Style 
Negotiate_LM_Key 
Negotiate_Netware 
Negotiate_NTLM 
Negotiate_Domain_Supplied 
Negotiate_WS_Supplied 
Negotiate_Local_Call 
Negotiate_Always_Sign 
Target_Type_Domain 
Target_Type_Server 
Target_Type_Share 
Negotiate_NTLM2_Key 
Request_Init_Response 
Request_Accept_Response 
Request_NonNT_Key 
Negotiate_Target_Info 
Negotiate_128 
Negotiate_Key_Exchange 
Negotiate_56 

Definition at line 44 of file kntlm.h.


Member Function Documentation

QByteArray KNTLM::createBlob ( const QByteArray &  targetinfo  )  [static]

Definition at line 295 of file kntlm.cpp.

bool KNTLM::getAuth ( QByteArray &  auth,
const QByteArray &  challenge,
const QString &  user,
const QString &  password,
const QString &  domain = QString::null,
const QString &  workstation = QString::null,
bool  forceNTLM = false,
bool  forceNTLMv2 = false 
) [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 empty, it will be extracted from the challenge.
workstation - the user's workstation.
forceNTLM - force the use of NTLM authentication (either v1 or v2).
forceNTLMv2 - force the use of NTLMv2 or LMv2 authentication. If false, NTLMv2 support is autodetected from the challenge.
Returns:
true if auth filled with the Type 3 message, false if an error occured (challenge data invalid, or NTLM authentication forced, but the challenge data says no NTLM supported).

Definition at line 121 of file kntlm.cpp.

QByteArray KNTLM::getBuf ( const QByteArray &  buf,
const SecBuf &  secbuf 
) [static]

Extracts a byte array from an NTLM structure.

Definition at line 56 of file kntlm.cpp.

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

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

Definition at line 177 of file kntlm.cpp.

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

Calculates the LMv2 response.

Definition at line 262 of file kntlm.cpp.

bool KNTLM::getNegotiate ( QByteArray &  negotiate,
const QString &  domain = QString::null,
const QString &  workstation = QString::null,
Q_UINT32  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.

Definition at line 101 of file kntlm.cpp.

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

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

Definition at line 229 of file kntlm.cpp.

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

Calculates the NTLMv2 response.

Definition at line 253 of file kntlm.cpp.

QString KNTLM::getString ( const QByteArray &  buf,
const SecBuf &  secbuf,
bool  unicode 
) [static]

Extracts a string field from an NTLM structure.

Definition at line 35 of file kntlm.cpp.

QByteArray KNTLM::hmacMD5 ( const QByteArray &  data,
const QByteArray &  key 
) [static]

Definition at line 313 of file kntlm.cpp.

QByteArray KNTLM::lmHash ( const QString &  password  )  [static]

Calculates the LanManager hash of the specified password.

Definition at line 189 of file kntlm.cpp.

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

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

Definition at line 211 of file kntlm.cpp.

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

Calculates the LMv2 response.

Definition at line 283 of file kntlm.cpp.

QByteArray KNTLM::ntlmHash ( const QString &  password  )  [static]

Returns the NTLM hash (MD4) from the password.

Definition at line 241 of file kntlm.cpp.

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

Returns the NTLMv2 hash.

Definition at line 273 of file kntlm.cpp.


The documentation for this class was generated from the following files:
  • kntlm.h
  • kntlm.cpp

kio

Skip menu "kio"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal