Reputation: 91
I want to use the Jasypt library to decrypt properties in Spring through the EncryptablePropertyPlaceholderConfigurer class. I want to encrypt/decrypt these properties using the asymmetric public/private key approach.
Could you please confirm the Jasypt does or does not support it (out of the box or maybe using the JCE)? If not is there any other library doing it (providing both the spring integration and asymmetric public/private key approach)?
Upvotes: 2
Views: 4299
Reputation: 1
It supports Asymmetric encryption. You can generate private and public key with these commands
openssl genpkey -out zisky.pem -algorithm RSA -pkeyopt rsa_keygen_bits:2048<br>
openssl rsa -in zisky.pem -pubout > zisky.pub
Add these properties:
jasypt.encryptor.privateKeyFormat=PEM<br>
jasypt.encryptor.privateKeyLocation=classpath:my_example.pem
Use version 3.0.3.
Upvotes: 1
Reputation: 91
Finally, I used the following solution. Maybe somebody will find it is useful.
Upvotes: 3
Reputation: 25874
I don't know about Jasypt but asymmetric encryption is not suitable to encrypt data bigger than its key size. It's unlikely that any library offers a full encryption using an asymmetric algorithm. That's not the purpose of asymmetric encryption.
Usually you share a symmetric key (e.g. AES) using an asymmetric encryption (e.g. RSA).
Upvotes: 0