开发者

Securely saving password locally java? [duplicate]

This question already has answers here: Closed 10 years ago.

Possible Duplicate:

What is the best practice for securely storing passwords in Java

开发者_运维知识库

I am working on a java application and would like to save password locally on a file. I am not sure how to achieve this, any help would be appreciated.


You don't provide much information for this.
My first advice would be not to save the password per se, but instead save its hash value.
When you need to verify that someone has provided the correct password just compare the hashes.
You could use for example MD5 for this Message Digest

If you need to be able to retrieve the password then you have to encrypt it.
For that you could use e.g. AES AES in Java but for symmetric encryption you have a new problem now, where to store the decryption key.

It depends on what you want to do and requirement.
Your question does not say much


You can use AES / DES algorithm and write the encrypted password to disk.


I finaly figured it out. What I did was simply converte the charecters into ascii code and then add or subract depending on the the situation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜