Reputation: 49329
I have a vector of user passwords. I would like to save this vector to a file and encrypt it. Then load and decrypt the file to get the passwords. I would like my users to enter a pass phrase to decrypt the files. Which algorithm should i choose? and How can i encrypt the vector before writing the file?
Upvotes: 0
Views: 800
Reputation: 8722
I think you can checkout my other post (example included) and get a headstart.
few characters missing after decryption
Basically you just need to use CipherInputStream & CipherOutputStream, and that's it! :)
Upvotes: 1
Reputation: 346240
Encryption in Java is done using the Java Cryptography Architecture (doc contains example code). As for which algorithm to use, AES should be fine.
However, don't use Vector
- it's utterly outdated and should be replaced with ArrayList
(this has nothing to do with cryptography, but using Vector
marks you as someone who's been learning Java from 12 year old books).
Upvotes: 3