• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • 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/QBool>
00024 #include <QtCore/QByteRef>
00025 #include <QtCore/QString>
00026 
00027 #include "kntlm_export.h"
00028 
00041 class KNTLM_EXPORT KNTLM {
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   {
00081     quint16 len;
00082     quint16 maxlen;
00083     quint32 offset;
00084   } SecBuf;
00085 
00089   typedef struct
00090   {
00091     char signature[8]; /* "NTLMSSP\0" */
00092     quint32 msgType; /* 1 */
00093     quint32 flags;
00094     SecBuf domain;
00095     SecBuf workstation;
00096   } Negotiate;
00097 
00101   typedef struct
00102   {
00103     char signature[8];
00104     quint32 msgType; /* 2 */
00105     SecBuf targetName;
00106     quint32 flags;
00107     quint8 challengeData[8];
00108     quint32 context[2];
00109     SecBuf targetInfo;
00110   } Challenge;
00111 
00115   typedef struct
00116   {
00117     char signature[8];
00118     quint32 msgType; /* 3 */
00119     SecBuf lmResponse;
00120     SecBuf ntResponse;
00121     SecBuf domain;
00122     SecBuf user;
00123     SecBuf workstation;
00124     SecBuf sessionKey;
00125     quint32 flags;
00126   } Auth;
00127   
00128   typedef struct
00129   {
00130     quint32 signature;
00131     quint32 reserved;
00132     quint64 timestamp;
00133     quint8  challenge[8];
00134     quint8  unknown[4];
00135     //Target info block - variable length
00136   } Blob;
00137 
00148   static bool getNegotiate( QByteArray &negotiate, const QString &domain = QString(), 
00149     const QString &workstation = QString(),
00150     quint32 flags = Negotiate_Unicode | Request_Target | Negotiate_NTLM );
00171   static bool getAuth( QByteArray &auth, const QByteArray &challenge, const QString &user,
00172     const QString &password, const QString &domain = QString(), 
00173     const QString &workstation = QString(), AuthFlags authflags = Add_LM );
00174 
00178   static QByteArray getLMResponse( const QString &password, const unsigned char *challenge );
00182   static QByteArray lmHash( const QString &password );
00186   static QByteArray lmResponse( const QByteArray &hash, const unsigned char *challenge );
00187 
00191   static QByteArray getNTLMResponse( const QString &password, const unsigned char *challenge );
00195   static QByteArray ntlmHash( const QString &password );
00196 
00200   static QByteArray getNTLMv2Response( const QString &target, const QString &user, 
00201     const QString &password, const QByteArray &targetInformation, 
00202     const unsigned char *challenge );
00203 
00207   static QByteArray getLMv2Response( const QString &target, const QString &user,
00208     const QString &password, const unsigned char *challenge );
00209 
00213   static QByteArray ntlmv2Hash( const QString &target, const QString &user, const QString &password );
00214 
00218   static QByteArray lmv2Response( const QByteArray &hash,
00219     const QByteArray &clientData, const unsigned char *challenge );
00220 };
00221 
00222 Q_DECLARE_OPERATORS_FOR_FLAGS( KNTLM::AuthFlags )
00223 
00224 #endif /* KNTLM_H */

KIO

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
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