|
|
|
|
|
by treenyc
4537 days ago
|
|
ah ok, so what is the recommendation for storing password in a scripting language like Ruby, Python, RingoJS, NodeJS, PHP, etc? Don't think they have fancy function to determine to store the variables in CPU register or encrypted memory? I got the feeling that all these should have being taken care of on the hardware level, but someone just got too lazy during the design process and forgot to patch up the security flaw. Kinda like how everyone was still using telnet to get into their *nix servers in the 90's. |
|
The way it generally works is you keep a user's encrypted pass with a unique per-user salt stored on disk (usually in a database of some sort). When you need to authenticate a user, your script will ask the user for their password. Then, you encrypt this input pass with the stored salt. Finally, you compare the encrypted input pass with the original encrypted pass on disk. If they match, you're good. At no point do you store passwords on disk that have not been encrypted (via bcrypt or similar). Depending on the security needed (i.e. your threat model and risk) this can get tricky if things like hibernation or virtual machines are involved.
If you're confused at all about this, I would browse the security forums (http://security.stackexchange.com/) and ask for expert advice.