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

KIO

kntlm.h
Go to the documentation of this file.
00001 /*
00002    This file is part of the KDE libraries.
00003    Copyright (c) 2004 Szombathelyi György <gyurco@freemail.hu>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License version 2 as published by the Free Software Foundation.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018  */
00019 
00020 #ifndef KNTLM_H
00021 #define KNTLM_H
00022 
00023 #include <QtCore/QString>
00024 #include <QtCore/QByteArray>
00025 
00026 #include "kntlm_export.h"
00027 
00040 class KNTLM_EXPORT KNTLM
00041 {
00042 public:
00043 
00044     enum Flags {
00045         Negotiate_Unicode         = 0x00000001,
00046         Negotiate_OEM             = 0x00000002,
00047         Request_Target            = 0x00000004,
00048         Negotiate_Sign            = 0x00000010,
00049         Negotiate_Seal            = 0x00000020,
00050         Negotiate_Datagram_Style  = 0x00000040,
00051         Negotiate_LM_Key          = 0x00000080,
00052         Negotiate_Netware         = 0x00000100,
00053         Negotiate_NTLM            = 0x00000200,
00054         Negotiate_Domain_Supplied = 0x00001000,
00055         Negotiate_WS_Supplied     = 0x00002000,
00056         Negotiate_Local_Call      = 0x00004000,
00057         Negotiate_Always_Sign     = 0x00008000,
00058         Target_Type_Domain        = 0x00010000,
00059         Target_Type_Server        = 0x00020000,
00060         Target_Type_Share         = 0x00040000,
00061         Negotiate_NTLM2_Key       = 0x00080000,
00062         Request_Init_Response     = 0x00100000,
00063         Request_Accept_Response   = 0x00200000,
00064         Request_NonNT_Key         = 0x00400000,
00065         Negotiate_Target_Info     = 0x00800000,
00066         Negotiate_128             = 0x20000000,
00067         Negotiate_Key_Exchange    = 0x40000000,
00068         Negotiate_56              = 0x80000000
00069     };
00070 
00071     enum AuthFlag {
00072         Force_V1 = 0x1,
00073         Force_V2 = 0x2,
00074         Add_LM = 0x4
00075     };
00076 
00077     Q_DECLARE_FLAGS( AuthFlags, AuthFlag )
00078 
00079     typedef struct {
00080         quint16 len;
00081         quint16 maxlen;
00082         quint32 offset;
00083     } SecBuf;
00084 
00088     typedef struct {
00089         char signature[8]; /* "NTLMSSP\0" */
00090         quint32 msgType; /* 1 */
00091         quint32 flags;
00092         SecBuf domain;
00093         SecBuf workstation;
00094     } Negotiate;
00095 
00099     typedef struct {
00100         char signature[8];
00101         quint32 msgType; /* 2 */
00102         SecBuf targetName;
00103         quint32 flags;
00104         quint8 challengeData[8];
00105         quint32 context[2];
00106         SecBuf targetInfo;
00107     } Challenge;
00108 
00112     typedef struct {
00113         char signature[8];
00114         quint32 msgType; /* 3 */
00115         SecBuf lmResponse;
00116         SecBuf ntResponse;
00117         SecBuf domain;
00118         SecBuf user;
00119         SecBuf workstation;
00120         SecBuf sessionKey;
00121         quint32 flags;
00122     } Auth;
00123 
00124     typedef struct {
00125         quint32 signature;
00126         quint32 reserved;
00127         quint64 timestamp;
00128         quint8  challenge[8];
00129         quint8  unknown[4];
00130         //Target info block - variable length
00131     } Blob;
00132 
00143     static bool getNegotiate( QByteArray &negotiate, const QString &domain = QString(),
00144                               const QString &workstation = QString(),
00145                               quint32 flags = Negotiate_Unicode | Request_Target | Negotiate_NTLM );
00166     static bool getAuth( QByteArray &auth, const QByteArray &challenge, const QString &user,
00167                          const QString &password, const QString &domain = QString(),
00168                          const QString &workstation = QString(), AuthFlags authflags = Add_LM );
00169 
00173     static QByteArray getLMResponse( const QString &password, const unsigned char *challenge );
00174 
00178     static QByteArray lmHash( const QString &password );
00179 
00183     static QByteArray lmResponse( const QByteArray &hash, const unsigned char *challenge );
00184 
00188     static QByteArray getNTLMResponse( const QString &password, const unsigned char *challenge );
00189 
00193     static QByteArray ntlmHash( const QString &password );
00194 
00198     static QByteArray getNTLMv2Response( const QString &target, const QString &user,
00199                                          const QString &password, const QByteArray &targetInformation,
00200                                          const unsigned char *challenge );
00201 
00205     static QByteArray getLMv2Response( const QString &target, const QString &user,
00206                                        const QString &password, const unsigned char *challenge );
00207 
00211     static QByteArray ntlmv2Hash( const QString &target, const QString &user, const QString &password );
00212 
00216     static QByteArray lmv2Response( const QByteArray &hash,
00217                                     const QByteArray &clientData, const unsigned char *challenge );
00218 };
00219 
00220 Q_DECLARE_OPERATORS_FOR_FLAGS( KNTLM::AuthFlags )
00221 
00222 #endif /* KNTLM_H */

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

Skip menu "kdelibs"
  • 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
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.5
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