Spring Cloud Config - Encrypt Password

我是研究僧i 提交于 2019-12-08 04:07:34

问题


I saw that spring cloud config provides an /encrypt and /decrypt endpoints. How can I use the encrypt and decrypt endpoint via Advanced REST Client in order to view the encrypted or decrypted string?


回答1:


As Spring Cloud Config documentation states:

The server also exposes /encrypt and /decrypt endpoints (on the assumption that these will be secured and only accessed by authorized agents). If you are editing a remote config file you can use the Config Server to encrypt values by POSTing to the /encrypt endpoint.

For encryption, send a POST request to the /encrypt endpoint with the Clear Text as the request body:

$ curl localhost:8888/encrypt -d mysecret
682bc583f4641835fa2db009355293665d2647dade3375c0ee201de2a49f7bda

The inverse operation is also available via /decrypt (provided the server is configured with a symmetric key or a full key pair).

For decryption, send a POST request to the /decrypt endpoint with the Cipher Text as the request body:

$ curl localhost:8888/decrypt -d 682bc583f4641835fa2db00935529366...
mysecret


来源:https://stackoverflow.com/questions/37488311/spring-cloud-config-encrypt-password

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