Click here to Skip to main content
15,899,754 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
I have written a simple FTP Client-Server Code using Winsocks. Now I want to implement a simple Username-Password Authentication but after going through MSDN Authentication Links, I am very confused. Can you suggest some simple APIs for the same. Any help will be appreciated.
Posted
Comments
Mohibur Rashid 29-Feb-12 2:47am    
Would you tell me about Authentication for what? is that for FTP server?
Abhineet Ayan Verma 29-Feb-12 5:28am    
Authentication for Client Credentials like Username and Password.

1 solution

The process is pretty easy. The trick is that you don't want to transmit the passwords over the wire.

A simple method would work like this.

1. Client connects
2. Server sends a login required packet with challenge string
3. Client encrypts the username + password + challenge string into a response string.
4. Client sends the user name and response string to login with.
5. The server verifies that it gets the same value for the response string.

You can use the MD5 hash for the challenge string and response string. There is plenty of example source code for this, and other hash types on the web.

Further, if you don't want to store passwords on the server, you can hash the password against a secret string, and store that. The client would then do the same to the password the user enters, before hashing it again against the username and challenge string.
 
Share this answer
 
Comments
Abhineet Ayan Verma 29-Feb-12 1:01am    
Can you give me the link to some example or provide a sample here?
JackDingler 29-Feb-12 11:50am    
I can't share any of the code I've written for this, because of contractual obligations.

I would have to google online examples, just as you would. You would be in a better position than I, to see if an example meets your needs.

But look how I've laid it out. How would you address each step?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900