Jasypt and asymmetric encryption

徘徊边缘 提交于 2019-12-11 03:56:29

问题


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


回答1:


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.



回答2:


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



来源:https://stackoverflow.com/questions/29517807/jasypt-and-asymmetric-encryption

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!