Is there a dead-simple native method in Java to encrypt/decrypt a string with a key? I don't really care what type of encryption (AES, DES, etc..), I just care that it's bound by with a key and not easily breakable.
Ideally, I would like it to be a one line solution like so:
String encryptedString = NativeEncryptionClass.encrypt("this is the data", "key123");
Thanks
Not sure you can do it in a [legiable] one-liner, but you can achieve simple symmetrical encryption relatively easily - take a look at the following example:
PrivateExample using DES
I've used the Bouncy Castle library to good effect in the past.
If by native you mean, not depending on platform specific libraries, maybe jasypt might be interesting for you.
May be you should try using simple XOR encryption
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With