-1

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.

DarkCeptor44
  • 184
  • 3
  • 15
  • You could explore the source of http://www.jasypt.org – ThomasEdwin Dec 24 '17 at 07:34
  • Well, the golden rule is [don't roll your own](https://security.stackexchange.com/questions/18197/why-shouldnt-we-roll-our-own), but if you want to play try xor. – t.m.adam Dec 24 '17 at 07:42
  • Note: Base64 is not encryption, it is an encoding. The main difference is that there is no security in an encoding and encryption provides security with an encryption key. – zaph Dec 24 '17 at 14:08
  • What do you mean by "manually"? Pen and paper? For that I would suggest [Playfair](https://en.wikipedia.org/wiki/Playfair_cipher) as an option. – rossum Dec 29 '17 at 12:01

1 Answers1

0

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

gusto2
  • 11,210
  • 2
  • 17
  • 36