javaencryptioncryptographybase64passphrase

Java - How to encrypt data manually using passphrase?


I am trying to encrypt and decrypt a file just for fun. For now I'm using Base64 but I want to do it using a passphrase. I would appreciate if there was some way of doing that manually without using so many already-made classes. I like to make my own.

SOLUTION: As suggested by @ThomasEdwin, I've checked Jasypt and it is really useful, I will play with the tools a little and then figure out what I'm gonna do using the source code. Thank you all for the help.


Solution

  • As commented the Base64 is encoding, not encryption.

    There are some examples how to encrypt data properly using Java crypto API. There is as well example for password based encryption.

    There are higher level libraries (as Jasyp), depends how much interoperability do you need.

    And after encryption you can use base64 to encode data to be text-representable