Question : ADO.NET Insert Command

Hello,

I'm looking for a way to create a signup form with 3 fields. Name, username, & password. However i need to beable to encrypt the password so that when i insert the new record in the DB it encrypts the password in the password field. I also need to know how to unencrypt the password to retrieve if need be.

using ASP.NET 3.5 VB

Answer : ADO.NET Insert Command

You just encrypt the password again, and compare the newly encrypted password with the encrypted password in the database. If they match, then you know the person is who they claim to be. That is all a password does--authenticate someones identity to allow access.

So if the password is bob, and I call my Encrypt routine like so Encrypt("bob","bob")

inside it encrypts the word "bob" using the key "bob"

When the person logs in the next time, take whatever password they give you...should be "bob"...
call Encrypt("bob","bob")...  of course you'd pass in variables that contained bob or whatever, like Encrypt(strPW,strPW)...  if the result of the Encrypt function, which returns the encrypted string matches whatever is in the database...ie. there is a  record for the username given with the password (an encrypted value) that matches what was supplied and encrypted, then let them in.
Random Solutions  
 
programming4us programming4us