Visual Basic .NET Forums  
Click here to advertise with us

Go Back   Visual Basic .NET Forums > VB.NET > Security

Security Discussion on securing VB.NET applications, end-user configuration, application activation, etc.

VB.NET Forums Newsletter Signup:
Email address:


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-04-2010, 4:10 AM
VB.NET Forum Newbie
.NET Framework: .NET 2.0
 
Join Date: Feb 2010
Age: 22
Posts: 18
Reputation: 4
swethajain is on a distinguished programming path ahead
Question encrypt & decrypt password

Hi
I have a login page with username & password.I want the password to be encrypted while inserting into the database &decrypted while the user logins and check whether it is valid or not. can anyone give me the source code?

Thanks,
Swetha
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-04-2010, 5:28 AM
JohnH's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Dec 2005
Location: Norway
Age: 37
Posts: 10,322
Reputation: 1315
JohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond repute
Default

You don't normally keep password as decryptable data, you use a one-way hash. Each time user enters a password you can hash it and compare with the original. That way there is 'no' way for unauthorized to get that information from your data.
Code:
Dim pass As String = "word"
Dim sha As New System.Security.Cryptography.SHA1Managed
Dim hash As String = Convert.ToBase64String(sha.ComputeHash(System.Text.Encoding.UTF8.GetBytes(pass)))
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-05-2010, 12:33 AM
VB.NET Forum Newbie
.NET Framework: .NET 2.0
 
Join Date: Feb 2010
Age: 22
Posts: 18
Reputation: 4
swethajain is on a distinguished programming path ahead
Default

Hi
Thank you soo much for the reply.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





All times are GMT -4. The time now is 7:58 AM.

Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2


For advertising opportunities click here.