• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KIO

  • sources
  • kde-4.12
  • kdelibs
  • kio
  • misc
  • kntlm
kntlm.h
Go to the documentation of this file.
1 /*
2  This file is part of the KDE libraries.
3  Copyright (c) 2004 Szombathelyi György <gyurco@freemail.hu>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License version 2 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef KNTLM_H
21 #define KNTLM_H
22 
23 #include <QtCore/QString>
24 #include <QtCore/QByteArray>
25 
26 #include "kntlm_export.h"
27 
40 class KNTLM_EXPORT KNTLM
41 {
42 public:
43 
44  enum Flags {
45  Negotiate_Unicode = 0x00000001,
46  Negotiate_OEM = 0x00000002,
47  Request_Target = 0x00000004,
48  Negotiate_Sign = 0x00000010,
49  Negotiate_Seal = 0x00000020,
50  Negotiate_Datagram_Style = 0x00000040,
51  Negotiate_LM_Key = 0x00000080,
52  Negotiate_Netware = 0x00000100,
53  Negotiate_NTLM = 0x00000200,
54  Negotiate_Domain_Supplied = 0x00001000,
55  Negotiate_WS_Supplied = 0x00002000,
56  Negotiate_Local_Call = 0x00004000,
57  Negotiate_Always_Sign = 0x00008000,
58  Target_Type_Domain = 0x00010000,
59  Target_Type_Server = 0x00020000,
60  Target_Type_Share = 0x00040000,
61  Negotiate_NTLM2_Key = 0x00080000,
62  Request_Init_Response = 0x00100000,
63  Request_Accept_Response = 0x00200000,
64  Request_NonNT_Key = 0x00400000,
65  Negotiate_Target_Info = 0x00800000,
66  Negotiate_128 = 0x20000000,
67  Negotiate_Key_Exchange = 0x40000000,
68  Negotiate_56 = 0x80000000
69  };
70 
71  enum AuthFlag {
72  Force_V1 = 0x1,
73  Force_V2 = 0x2,
74  Add_LM = 0x4
75  };
76 
77  Q_DECLARE_FLAGS( AuthFlags, AuthFlag )
78 
79  typedef struct {
80  quint16 len;
81  quint16 maxlen;
82  quint32 offset;
83  } SecBuf;
84 
88  typedef struct {
89  char signature[8]; /* "NTLMSSP\0" */
90  quint32 msgType; /* 1 */
91  quint32 flags;
92  SecBuf domain;
93  SecBuf workstation;
94  } Negotiate;
95 
99  typedef struct {
100  char signature[8];
101  quint32 msgType; /* 2 */
102  SecBuf targetName;
103  quint32 flags;
104  quint8 challengeData[8];
105  quint32 context[2];
106  SecBuf targetInfo;
107  } Challenge;
108 
112  typedef struct {
113  char signature[8];
114  quint32 msgType; /* 3 */
115  SecBuf lmResponse;
116  SecBuf ntResponse;
117  SecBuf domain;
118  SecBuf user;
119  SecBuf workstation;
120  SecBuf sessionKey;
121  quint32 flags;
122  } Auth;
123 
124  typedef struct {
125  quint32 signature;
126  quint32 reserved;
127  quint64 timestamp;
128  quint8 challenge[8];
129  quint8 unknown[4];
130  //Target info block - variable length
131  } Blob;
132 
143  static bool getNegotiate( QByteArray &negotiate, const QString &domain = QString(),
144  const QString &workstation = QString(),
145  quint32 flags = Negotiate_Unicode | Request_Target | Negotiate_NTLM );
166  static bool getAuth( QByteArray &auth, const QByteArray &challenge, const QString &user,
167  const QString &password, const QString &domain = QString(),
168  const QString &workstation = QString(), AuthFlags authflags = Add_LM );
169 
173  static QByteArray getLMResponse( const QString &password, const unsigned char *challenge );
174 
178  static QByteArray lmHash( const QString &password );
179 
183  static QByteArray lmResponse( const QByteArray &hash, const unsigned char *challenge );
184 
188  static QByteArray getNTLMResponse( const QString &password, const unsigned char *challenge );
189 
193  static QByteArray ntlmHash( const QString &password );
194 
198  static QByteArray getNTLMv2Response( const QString &target, const QString &user,
199  const QString &password, const QByteArray &targetInformation,
200  const unsigned char *challenge );
201 
205  static QByteArray getLMv2Response( const QString &target, const QString &user,
206  const QString &password, const unsigned char *challenge );
207 
211  static QByteArray ntlmv2Hash( const QString &target, const QString &user, const QString &password );
212 
216  static QByteArray lmv2Response( const QByteArray &hash,
217  const QByteArray &clientData, const unsigned char *challenge );
218 };
219 
220 Q_DECLARE_OPERATORS_FOR_FLAGS( KNTLM::AuthFlags )
221 
222 #endif /* KNTLM_H */
KNTLM::SecBuf::len
quint16 len
Definition: kntlm.h:80
KNTLM::Auth::flags
quint32 flags
Definition: kntlm.h:121
KNTLM::Auth::msgType
quint32 msgType
Definition: kntlm.h:114
KNTLM::Auth::lmResponse
SecBuf lmResponse
Definition: kntlm.h:115
KNTLM::Negotiate::msgType
quint32 msgType
Definition: kntlm.h:90
KNTLM::Challenge::targetInfo
SecBuf targetInfo
Definition: kntlm.h:106
KNTLM::Negotiate::workstation
SecBuf workstation
Definition: kntlm.h:93
KNTLM::Negotiate::domain
SecBuf domain
Definition: kntlm.h:92
KNTLM
KNTLM class implements the NTLM authentication protocol.
Definition: kntlm.h:40
quint32
QString
KNTLM::SecBuf::maxlen
quint16 maxlen
Definition: kntlm.h:81
KNTLM::AuthFlag
AuthFlag
Definition: kntlm.h:71
KNTLM::Negotiate
The NTLM Type 1 structure.
Definition: kntlm.h:88
KNTLM::Auth::domain
SecBuf domain
Definition: kntlm.h:117
KNTLM::Auth::workstation
SecBuf workstation
Definition: kntlm.h:119
KNTLM::SecBuf
Definition: kntlm.h:79
KNTLM::Challenge::targetName
SecBuf targetName
Definition: kntlm.h:102
KNTLM::Challenge::msgType
quint32 msgType
Definition: kntlm.h:101
KNTLM::Blob::signature
quint32 signature
Definition: kntlm.h:125
KNTLM::Challenge
The NTLM Type 2 structure.
Definition: kntlm.h:99
KNTLM::Auth::ntResponse
SecBuf ntResponse
Definition: kntlm.h:116
KNTLM::Blob::reserved
quint32 reserved
Definition: kntlm.h:126
quint64
KNTLM::Blob::timestamp
quint64 timestamp
Definition: kntlm.h:127
KNTLM::Negotiate::flags
quint32 flags
Definition: kntlm.h:91
KNTLM::Flags
Flags
Definition: kntlm.h:44
KNTLM::Blob
Definition: kntlm.h:124
KNTLM::Challenge::flags
quint32 flags
Definition: kntlm.h:103
kntlm_export.h
KNTLM::SecBuf::offset
quint32 offset
Definition: kntlm.h:82
KNTLM::Auth
The NTLM Type 3 structure.
Definition: kntlm.h:112
KNTLM::Auth::sessionKey
SecBuf sessionKey
Definition: kntlm.h:120
KNTLM::Auth::user
SecBuf user
Definition: kntlm.h:118
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIO

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal