Spring config server security encryption and decryption not working

别等时光非礼了梦想. 提交于 2020-07-08 22:54:15

问题


I am using spring config server and spring security. I have followed the link https://cloud.spring.io/spring-cloud-config/multi/multi__spring_cloud_config_server.html I have added JCF in C:\Program Files\Java\jdk1.8.0_171\jre\lib\security folder. When I post localhost:8080/encrypt { "description": "The encryption algorithm is not strong enough", "status": "INVALID" } This response comes. Please let me know the issue.


回答1:


if you are getting {"description": "The encryption algorithm is not strong enough", "status": "INVALID" } response.The solution is just create bootstrap.properties file in config server and add encrypt.key="Secrete Key" property.




回答2:


Disclaimer: I am running org.springframework.cloud:spring-cloud-config-server:2.0.6.RELEASE.

It's not just enought to enable unlimited crypto policy (btw, it is by default starting from jdk8.161), but you have to also provide (in case you want to use symmetric cryptography) encrypt.key property.

You can find it down the documentation: http://cloud.spring.io/spring-cloud-config/2.0.x/single/spring-cloud-config.html#_key_management

PS: Set it within bootstrap.properties.




回答3:


bootstrap.properties are meant to be tracked under source control so i would rather reference the envcrypt.key value as an operating system environment variable.

For unix systems use export ENCRYPT_KEY=YOURKEY

Add this variable to one of start up files ~/bashrc, ~.profile or ~/.login to make it permanent



来源:https://stackoverflow.com/questions/53096567/spring-config-server-security-encryption-and-decryption-not-working

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