Security and Cryptography
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationSecurity and Cryptography
Receive the tools necessary to be the rock star of your field. Our 12-month program teaches you the evolving world of multi-channel marketing as well as the complex issues and opportunities found in the industry.

ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month!
Download and Activate to enter!

Web development can be a daunting task, even for specialists. There is a lot of information to absorb and a lot of technologies to learn in order to manage a superior website. When trying to learn the ropes, developers need a reliable source to introduce new ideas that can be easily implemented. When working on large projects, even web veterans may run into a technology or an aspect of a technology that they are unfamiliar with.

Learn More!


Download to Enter
| Contest Rules

Tutorials | Forums

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 20th, 2007, 04:10 PM
JMorjaria JMorjaria is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2005
Posts: 640 JMorjaria User rank is Sergeant (500 - 2000 Reputation Level)JMorjaria User rank is Sergeant (500 - 2000 Reputation Level)JMorjaria User rank is Sergeant (500 - 2000 Reputation Level)JMorjaria User rank is Sergeant (500 - 2000 Reputation Level)JMorjaria User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 15 h 57 m 58 sec
Reputation Power: 23
Encrypt a password - store it in MySQL and retrieve with vb.net

I want to create a random password, encrypt it and have vb.net retrieve it and unencrypt it.

(Creating random password is easy and ive done that)

I have no experience with two way encryption what so ever, and although have read a fair amount and understand private / public keys etc I still have no clue about how to actually impliment it.

The information excrypted is quite important (mysql user passwords)

Any tutorials? Ideas?

Reply With Quote
  #2  
Old November 20th, 2007, 04:22 PM
ptr2void ptr2void is offline
I haz teh codez!
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Dec 2003
Posts: 2,167 ptr2void User rank is General 11st Grade (Above 100000 Reputation Level)ptr2void User rank is General 11st Grade (Above 100000 Reputation Level)ptr2void User rank is General 11st Grade (Above 100000 Reputation Level)ptr2void User rank is General 11st Grade (Above 100000 Reputation Level)ptr2void User rank is General 11st Grade (Above 100000 Reputation Level)ptr2void User rank is General 11st Grade (Above 100000 Reputation Level)ptr2void User rank is General 11st Grade (Above 100000 Reputation Level)ptr2void User rank is General 11st Grade (Above 100000 Reputation Level)ptr2void User rank is General 11st Grade (Above 100000 Reputation Level)ptr2void User rank is General 11st Grade (Above 100000 Reputation Level)ptr2void User rank is General 11st Grade (Above 100000 Reputation Level)ptr2void User rank is General 11st Grade (Above 100000 Reputation Level)ptr2void User rank is General 11st Grade (Above 100000 Reputation Level)ptr2void User rank is General 11st Grade (Above 100000 Reputation Level)ptr2void User rank is General 11st Grade (Above 100000 Reputation Level)ptr2void User rank is General 11st Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 3 Days 19 h 1 m 4 sec
Reputation Power: 1720
This is in the wrong forum (I've notified the admins), but generally you don't store passwords in a database. You use a salted hash to create string which is saved to the DB. When the password is required, the user enters it, the program performs a hash of the salt and password and compares it to the DB value.

Here's a good link on "storing" passwords.

Last edited by ptr2void : November 20th, 2007 at 04:23 PM. Reason: Added fact that I notified admins of wrong forum

Reply With Quote
  #3  
Old November 20th, 2007, 04:31 PM
JMorjaria JMorjaria is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2005
Posts: 640 JMorjaria User rank is Sergeant (500 - 2000 Reputation Level)JMorjaria User rank is Sergeant (500 - 2000 Reputation Level)JMorjaria User rank is Sergeant (500 - 2000 Reputation Level)JMorjaria User rank is Sergeant (500 - 2000 Reputation Level)JMorjaria User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 15 h 57 m 58 sec
Reputation Power: 23
Yes that is what I generally do, but this is a little different.

I have a web application that has one database to each customer.
These databases are accessed by a mysql user with superglobal permissions. This user however only has localhost connection.

I am developing a vb.net application designed on a PDA which will access the MySQL database and download the information so the customer can work locally.

The problem is I don't want the PDA to use a MySQL user that has superglobal permission because if someone somehow hacks the PDA app and gains access to the username and password of the MySQL user they could attack all databases on the server.

So I decided I would create seperate MySQL users for each database for the PDA to use.

The PDA will connect to a specific table where all the customers MySQL usernames and passwords are stored(encrypted) and retrieve the specific one to connect to the specific customers database.

I believe the idea to be sound, and have discussed this with another developer. Obvioulsy any input is welcome.

If anyone know how to encrypt a password in php and decrypt it in vb.net id really appreciate that!??



If this is more of a security issue, (which on hindsight it probably is) can an moderator please move it,

Thanks

Reply With Quote
  #4  
Old November 20th, 2007, 07:09 PM
E-Oreo's Avatar
E-Oreo E-Oreo is offline
Moderator
Click here for more information.
 
Join Date: Dec 2004
Posts: 6,459 E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)  Folding Points: 945 Folding Title: Novice Folder
Time spent in forums: 1 Month 2 Weeks 4 Days 3 h 8 m 59 sec
Reputation Power: 6144
Quote:
The PDA will connect to a specific table where all the customers MySQL usernames and passwords are stored(encrypted) and retrieve the specific one to connect to the specific customers database.


What exactly is the difference between an attacker compromising a PDA and stealing individual usernames/passwords for each database rather than compromising the PDA and stealing a master username/password? They still have access to the information either way, it's just a little more inconvenient the way you have it set up. If the attacker can steal your master password out of the application what is there to stop them from stealing the password to the username/password database and the encryption method and simply decrypting it themselves?

Reply With Quote
  #5  
Old November 20th, 2007, 07:17 PM
Muzza's Avatar
Muzza Muzza is offline
/usr/bin/drinking
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jul 2004
Posts: 719 Muzza User rank is General 14th Grade (Above 100000 Reputation Level)Muzza User rank is General 14th Grade (Above 100000 Reputation Level)Muzza User rank is General 14th Grade (Above 100000 Reputation Level)Muzza User rank is General 14th Grade (Above 100000 Reputation Level)Muzza User rank is General 14th Grade (Above 100000 Reputation Level)Muzza User rank is General 14th Grade (Above 100000 Reputation Level)Muzza User rank is General 14th Grade (Above 100000 Reputation Level)Muzza User rank is General 14th Grade (Above 100000 Reputation Level)Muzza User rank is General 14th Grade (Above 100000 Reputation Level)Muzza User rank is General 14th Grade (Above 100000 Reputation Level)Muzza User rank is General 14th Grade (Above 100000 Reputation Level)Muzza User rank is General 14th Grade (Above 100000 Reputation Level)Muzza User rank is General 14th Grade (Above 100000 Reputation Level)Muzza User rank is General 14th Grade (Above 100000 Reputation Level)Muzza User rank is General 14th Grade (Above 100000 Reputation Level)Muzza User rank is General 14th Grade (Above 100000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 2 h 53 m 7 sec
Reputation Power: 1883
I'd be concentrating my efforts on making the database access secure rather than having a seperate db for each user.

Also, you'd have a heap more backup files if you have seperate db's for each user.

Reply With Quote
  #6  
Old November 21st, 2007, 04:23 AM
JMorjaria JMorjaria is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2005
Posts: 640 JMorjaria User rank is Sergeant (500 - 2000 Reputation Level)JMorjaria User rank is Sergeant (500 - 2000 Reputation Level)JMorjaria User rank is Sergeant (500 - 2000 Reputation Level)JMorjaria User rank is Sergeant (500 - 2000 Reputation Level)JMorjaria User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 15 h 57 m 58 sec
Reputation Power: 23
yes your right, if the person got the admin user then they would have access to the table of user passwords, however if they are encrypted then surely they cannot use them.

They would need to unencypt then before they could connect to the other databases?

Yes your right about desaster recovery, I hadn't thought of that, I would need to recreate all users

What do you suggest, one user? How would I secure the sql database?

Reply With Quote
  #7  
Old November 21st, 2007, 07:36 AM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 20th Plane (14500 - 14999 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,802 jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 4 Days 4 h 32 m 44 sec
Reputation Power: 1059
Moved from PHP to Security/Cryptography ...

Database users should be as restrictive as possible when used in conjunction with public applications. If you also have a web-based admin panel that needs more rights, create a separate user for that (although we're assuming the admin side is secure, too).

SSL is how you keep users from stealing passwords in transit.
__________________
# Jeremy

Explain your problem instead of asking how to do what you decided was the solution.

Reply With Quote
  #8  
Old November 21st, 2007, 09:21 AM
JMorjaria JMorjaria is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2005
Posts: 640 JMorjaria User rank is Sergeant (500 - 2000 Reputation Level)JMorjaria User rank is Sergeant (500 - 2000 Reputation Level)JMorjaria User rank is Sergeant (500 - 2000 Reputation Level)JMorjaria User rank is Sergeant (500 - 2000 Reputation Level)JMorjaria User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 15 h 57 m 58 sec
Reputation Power: 23
Yes I am intending to use SSL for the online app, but that doesn't get over the problem of using one mysql user in the 'public application' (my PDA app).

If someone steals that user details, they can access everything.

Possibly encrypt the details on the PDA??

Reply With Quote
  #9  
Old November 21st, 2007, 09:29 AM
fishtoprecords's Avatar
fishtoprecords fishtoprecords is offline
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Sep 2007
Location: outside Washington DC
Posts: 2,629 fishtoprecords User rank is General 41st Grade (Above 100000 Reputation Level)fishtoprecords User rank is General 41st Grade (Above 100000 Reputation Level)fishtoprecords User rank is General 41st Grade (Above 100000 Reputation Level)fishtoprecords User rank is General 41st Grade (Above 100000 Reputation Level)fishtoprecords User rank is General 41st Grade (Above 100000 Reputation Level)fishtoprecords User rank is General 41st Grade (Above 100000 Reputation Level)fishtoprecords User rank is General 41st Grade (Above 100000 Reputation Level)fishtoprecords User rank is General 41st Grade (Above 100000 Reputation Level)fishtoprecords User rank is General 41st Grade (Above 100000 Reputation Level)fishtoprecords User rank is General 41st Grade (Above 100000 Reputation Level)fishtoprecords User rank is General 41st Grade (Above 100000 Reputation Level)fishtoprecords User rank is General 41st Grade (Above 100000 Reputation Level)fishtoprecords User rank is General 41st Grade (Above 100000 Reputation Level)fishtoprecords User rank is General 41st Grade (Above 100000 Reputation Level)fishtoprecords User rank is General 41st Grade (Above 100000 Reputation Level)fishtoprecords User rank is General 41st Grade (Above 100000 Reputation Level)  Folding Points: 2385494 Folding Title: Super Ultimate Folder - Level 5Folding Points: 2385494 Folding Title: Super Ultimate Folder - Level 5Folding Points: 2385494 Folding Title: Super Ultimate Folder - Level 5Folding Points: 2385494 Folding Title: Super Ultimate Folder - Level 5Folding Points: 2385494 Folding Title: Super Ultimate Folder - Level 5Folding Points: 2385494 Folding Title: Super Ultimate Folder - Level 5Folding Points: 2385494 Folding Title: Super Ultimate Folder - Level 5Folding Points: 2385494 Folding Title: Super Ultimate Folder - Level 5Folding Points: 2385494 Folding Title: Super Ultimate Folder - Level 5Folding Points: 2385494 Folding Title: Super Ultimate Folder - Level 5
Time spent in forums: 3 Weeks 4 Days 21 h 11 m 25 sec
Reputation Power: 3674
Quote:
Originally Posted by JMorjaria
Possibly encrypt the details on the PDA??


You can encipher data/messages on any platform that is programmable. Cell phones and PDAs clearly meet that citeria.

But a much more important question is who do you trust?

cryptography is well suited to protecting data in transit. The usual statement is that "Alice wants to send a message to Bob over unsafe channels" This works well. cryptography does does not work well when Alice wants to send something to Bob and doesn't trust Bob.

Look at all the DVD cracks, DeCSS, etc.

Reply With Quote
  #10  
Old November 21st, 2007, 09:40 AM
JMorjaria JMorjaria is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2005
Posts: 640 JMorjaria User rank is Sergeant (500 - 2000 Reputation Level)JMorjaria User rank is Sergeant (500 - 2000 Reputation Level)JMorjaria User rank is Sergeant (500 - 2000 Reputation Level)JMorjaria User rank is Sergeant (500 - 2000 Reputation Level)JMorjaria User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 15 h 57 m 58 sec
Reputation Power: 23
with all honesty I think im probably going over board, and your right, If I don't trust the person that is receiving the data then encrypting it is pointless as the PDA would have to have the other key anyway.

So the best thing to do is make is as awkward as possible, use one MySQL user, but limit what they can do, ie SELECT, UPDATE, INSERT and keep regular backups. Hopefully the .net programe will not be compramised and I can live happily every after!!!

Reply With Quote
  #11  
Old November 22nd, 2007, 02:30 AM
_ivo_ _ivo_ is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2006
Location: Victoria, Australia
Posts: 458 _ivo_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)_ivo_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)_ivo_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)_ivo_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)_ivo_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)_ivo_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)_ivo_ User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 4 Days 4 h 27 m 20 sec
Reputation Power: 81
In my opinion, you are going about your problem the wrong way-

You are worried about the security of your PDA(s). So you try to compensate by somehow increasing the security of your database. However, increasing the security of the database is increasing the security of the database, I would assume in many or most cases this does not help the problem you have with your PDA(s) - they are still the exact same, worrysome problem and they still have to get through and connect with the super secure databases, therefore still providing the same little hole (if maybe a little smaller) into the databases if they get hacked.

I'd suggesting reevaluating the problem, if your main issue is with the PDAs. Have a look at solving the problem on the PDA side of things rather than the database's.
If you can't trust the PDA's very well I don't see how giving them global access or whatever works hand in hand.
__________________

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationSecurity and Cryptography > Encrypt a password - store it in MySQL and retrieve with vb.net


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.

© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 10 - Follow our Sitemap