Create password protected text file using java [cl

2019-04-15 09:43发布

问题:

I want to write the java program which creats the text file with the password protection. That means when the user opens the file it should ask the password to open the file. Can any one please give me some idea how can I do this?

回答1:

Simple password protection is not possible, because (as @MaVRoSCy points out) the OS is not going to stop some other application from ignoring your password protection scheme.

What you could do is to encrypt the text file using a password as the encode / decode key. However, this approach is vulnerable to brute-force attack, and attack using "rainbow tables".

Encryption using proper keys with a large amount of entropy is a much better approach.


Anyway, this Question is a good place to start: Java 256-bit AES Password-Based Encryption



标签: java security