(05-23-2013, 10:21 AM)Ex094 Wrote: @Deque Yes you are pretty much correct, I got myself confused between and Encryption and Encoding. Well that makes sense as the passwords are not secure at all. Can you explain what you suggested a little bit more (The master password part)
Let's take as example how Firefox stores login data.
It saves these logins encrypted with 3DES. But it needs a key for doing so. A hardcoded key is not secure at all, but is the only solution if the user doesn't give a masterpassword.
If the user sets a masterpassword, this password is used to generate the key for 3DES encryption and decryption.
You don't have to save the password. The program recognizes that you have given the correct password by a known passphrase in the file.
I.e. imagine you have a passwordfile as txt that looks like this:
Code:
mysimplepassphrase
user:pass
user:pass
user:pass
...
Now you encrypt the whole file, including the passphrase.
Some time later when the user wants access to the passwords, he has to give you the masterpassword, that you used for encryption.
You also use the given password for decryption. If it was the right one, the passphase mysimplepassphase is readable again. You do something like (Pseudocode):
Code:
decryptedtext = decrypt(file)
firstline = decryptedtext.readLine()
if(firstline == "mysimplepassphrase") {
correctpass
} else {
wrongpass
}