I'm no expert in cryptography, cracking passwords and security. I need to store in the preferences a password and username for a SQL server that I'll use to connect the client to the SQL server.
I've been reading around, mostly here in SO but most of them are older than 2 years and we all know the security world is changing on a fast pace.
From what I read, I came to the conclusion that most people suggest hashing the password using SHA-XXX and/or recommend using jasypt to encrypt and decrypt the password
So my question is what is the most secure way to protect passwords in a preferences file? Can I just use SHA-512 with salt and save the salt in the preferences file as well? Is this safe?
It seems like you want to later decrypt and use that passwort to authenticate to the server. This means you can't hash it - hashing is good if you want the user to enter the password and then check if it is correct, but you cannot decrypt a hashed password to present it to the server.
Since your application will need to be able to decrypt the password to use it, an attacker that gains access to the configuration file will be able to decrypt the password the same way your application does it. No matter what you do, you can only make it more annoying to get the password (i.e. obfuscation/security by obscurity).
Steps you can take (program names that take that approach in braces):
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With