Encrypt a password - store it in MySQL and retrieve with vb.net
Discuss Encrypt a password - store it in MySQL and retrieve with vb.net in the Security and Cryptography forum on Dev Shed. Encrypt a password - store it in MySQL and retrieve with vb.net Security and Cryptography forum discussing issues related to coding, server applications, network protection, data protection, firewalls, ciphers and the like.
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.
Posts: 640
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)
Posts: 2,167
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.
Posts: 640
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,
Posts: 6,459
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?
Posts: 640
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?
Posts: 14,802
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.
Posts: 640
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.
Posts: 2,629
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.
Posts: 640
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!!!
Posts: 458
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.