简体   繁体   English

Spring Cloud Config - 加密密码

[英]Spring Cloud Config - Encrypt Password

I saw that spring cloud config provides an /encrypt and /decrypt endpoints. 我看到spring cloud config提供了/encrypt/decrypt端点。 How can I use the encrypt and decrypt endpoint via Advanced REST Client in order to view the encrypted or decrypted string? 如何通过Advanced REST Client使用加密和解密端点以查看加密或解密的字符串?

As Spring Cloud Config documentation states: 正如Spring Cloud Config文档所述:

The server also exposes /encrypt and /decrypt endpoints (on the assumption that these will be secured and only accessed by authorized agents). 服务器还公开/encrypt/decrypt端点(假设这些端点是安全的并且只能由授权代理访问)。 If you are editing a remote config file you can use the Config Server to encrypt values by POSTing to the /encrypt endpoint. 如果您正在编辑远程配置文件,则可以使用配置服务器通过POST/encrypt端点来加密值。

For encryption, send a POST request to the /encrypt endpoint with the Clear Text as the request body: 对于加密,请将POST请求发送到/encrypt端点,并将Clear Text作为请求正文:

$ 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). 反向操作也可通过/decrypt (假设服务器配置了对称密钥或完整密钥对)。

For decryption, send a POST request to the /decrypt endpoint with the Cipher Text as the request body: 对于解密,请将POST请求发送到/decrypt端点,并使用Cipher Text作为请求正文:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM