Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C# Get Username and password from the Client using sockets ?
Posted
Updated 18-Apr-14 1:24am
v2

1 solution

Passing a password (in its original form) is the utterly bad idea. For authentication, you never need to pass it through the network or store anywhere. Anywhere at all. Disagree, surprised? The see my past answers:
i already encrypt my password but when i log in it gives me an error. how can decrypte it[^],
Decryption of Encrypted Password[^],
storing password value int sql server with secure way[^].

—SA
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 15-Apr-14 16:25pm    
Same thing...
—SA
Sergey Alexandrovich Kryukov 15-Apr-14 16:40pm    
You shouldn't; I explained why. You should only pass cryptographic hash of the password. If you already created correct communication through sockets, it should not be a bit of a problem for you.
—SA
Sergey Alexandrovich Kryukov 15-Apr-14 17:00pm    
You can either use another TCP channel, or you can extend your existing application-level protocol (don't tell me you don't have any; you do, even if you don't call it a protocol) to include authentication.
—SA
Sergey Alexandrovich Kryukov 15-Apr-14 17:16pm    
It would take considerable time to write. But you already have code; how about understanding what to add to the code? See what kinds of messages are already circulating through your communication channel. Perhaps they have different types. Add one more, authentication. Or, it could be always the first message after connection...
—SA
Sergey Alexandrovich Kryukov 15-Apr-14 17:28pm    
Yes, but not username + password. Send username + hash(password), say SHA256(password). Server side compares hash with password hash created and stored as a result of initial password setup and authenticate the user or deny.
—SA

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