VB icon

_ Authenticate via HTTP 401, digest calculator (You have no idea how long this took to work out! ) _

Email
Submitted on: 1/24/2015 11:33:00 PM
By: Jon Barker (from psc cd)  
Level: Advanced
User Rating: By 3 Users
Compatibility: VB 4.0 (32-bit), VB 5.0, VB 6.0
Views: 2533
 
     This code takes into account the NONCE, CNONCE, NONCE-count, Username, Password, HTTP Method, URi, realm......... and finally QOP type :) THIS CODE IS FOR WEB DEVELOPERS WHO WISH TO AUTHENTICATE VIA HTTP, AND KNOW WHAT ALL OF THE ABOVE ARE... (if you dont, i suggest you stop reading now :)
 

Windows API/Global Declarations:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
'**************************************
'Windows API/Global Declarations for :_ Authenticate via HTTP 401, digest calculator (You have no idea how long this took to work out! ) _
'**************************************
'IF YOU DO NOT HAVE THE MD5 DLL, GET IT HERE:
'http://www.esquadro.com.br/md5bas.zip
Private Declare Sub MDFile Lib "aamd532.dll" (ByVal f As String, ByVal r As String)
Private Declare Sub MDStringFix Lib "aamd532.dll" (ByVal f As String, ByVal t As Long, ByVal r As String)
Public Function MD5String(KeyAndPass As String) As String
 Dim r As String * 32, t As Long
 r = Space(32)
 t = Len(KeyAndPass)
 MDStringFix KeyAndPass, t, r
 MD5String = r
End Function
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: _ Authenticate via HTTP 401, digest calculator (You have no idea how long this took to work out! ) _
' Description:This code takes into account the NONCE, CNONCE, NONCE-count, Username, Password, HTTP Method, URi, realm......... and finally QOP type :)
THIS CODE IS FOR WEB DEVELOPERS WHO WISH TO AUTHENTICATE VIA HTTP, AND KNOW WHAT ALL OF THE ABOVE ARE... (if you dont, i suggest you stop reading now :)
' By: Jon Barker (from psc cd)
'**************************************

RESPONSE RECEIVED FROM HTTP SERVER:
HTTP/1.1 401 Authorization Required..Server: Microsoft-IIS/5.0..Date: Tue, 07 May 2002 17:14:49 GMT..P3P:CP="BUS CUR CONo FIN IVDo ONL OUR PHY SAMo TELo"..Connection: close..Content-Type: text/html..WWW-Authenticate: Digest realm="hotmail.com", nonce="MTAyMDc5MTY4OTowZjY5YmE1NjEzNmM5YTE4NGZmNGQ1ZWFkNzU3ZTIxNw==", qop="auth"..X-Dav-Error: 401 Wrong email address....HMServer: H: DAV73 V: WIN2K 09.04.50.0031 i D: Apr 18 2002 12:14:38...
=============================================
TO CALCULATE THE RESPONSE VALUE:
MsgBox (GetResponse("MTAyMDc5MTY4OTowZjY5YmE1NjEzNmM5YTE4NGZmNGQ1ZWFkNzU3ZTIxNw==", "b6327c933ceeb677f8d6056c60aeabcb", "00000001", "auth", "[USERNAME]", "[PASSWORD]", "hotmail.com", "PROPFIND", "/cgi-bin/hmdata"))
=============================================
Function GetResponse(Nonce As String, CNonce As String, NonceCount As String, QOP As String, Username As String, Password As String, Realm As String, Method As String, URi As String)
 Dim Buffer As String
 Dim Buffer2 As String
 Dim Buffer3 As String
 
 Buffer = MD5String(Username & ":" & Realm & ":" & Password)
 Buffer2 = MD5String(Method & ":" & URi)
 Buffer3 = MD5String(Buffer & ":" & Nonce & ":" & NonceCount & ":" & CNonce & ":" & QOP & ":" & Buffer2)
 
 GetResponse = Buffer3
End Function


Other 10 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.