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?
Asked
Active
Viewed 4,524 times
1
-
This is not possible! The OS will open the txt file no matter what – MaVRoSCy Aug 30 '13 at 05:59
1 Answers
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
-
an AES brute force attack would be impractical http://crypto.stackexchange.com/questions/1145/how-much-would-it-cost-in-u-s-dollars-to-brute-force-a-256-bit-key-in-a-year – kyle k Aug 30 '13 at 06:29
-
1Nonsense! A system that uses passwords as the "secret" is only as good as the passwords ... no matter what encryption algorithm you use. Please read the Question properly. – Stephen C Aug 30 '13 at 06:32
-