Jasypt and asymmetric encryption

2019-07-21 02:12发布

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)?

2条回答
别忘想泡老子
2楼-- · 2019-07-21 02:46

Finally, I used the following solution. Maybe somebody will find it is useful.

  1. Wrote a simple helper class decrypting the data using RSA (you can find how to do it here)
  2. Implemented my own version of PropertyPlaceholderConfigurer class by extending the original one (org.springframework.beans.factory.config.PropertyPlaceholderConfigurer) and calling the helper class to decode the data, whenever an encrypted property value was found.
查看更多
Evening l夕情丶
3楼-- · 2019-07-21 02:50

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).

查看更多
登录 后发表回答