java - Spring Cloud Config - 加密密码

标签 java spring spring-boot spring-cloud spring-cloud-config

我看到 Spring Cloud 配置提供了 /encrypt/decrypt 端点。如何通过高级 REST 客户端使用加密和解密端点来查看加密或解密的字符串?

最佳答案

Spring Cloud Config documentation状态:

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.

要进行加密,请向 /encrypt 端点发送一个 POST 请求,并将明文作为请求正文:

$ 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 端点发送一个 POST 请求,并将密文作为请求正文:

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

关于java - Spring Cloud Config - 加密密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37488311/

相关文章:

java - x =new int[2]; 是怎么做到的?在这个java代码中工作?

java - 使用 |= 将字节打包成 long 会产生意想不到的结果

java - doFilter Spring Security 中的 @Autowire 服务

java - 有没有办法在java中将变量转换为常量?

java - 如何在 Spring Boot 2 中保护具有角色的执行器端点?

java - 比较顺序是否存在差异?

java - SOAP 故障 : No trusted certs found

java - 如何在没有任何请求、 session 等的情况下获取上下文?

java - 如何在 Spring Boot ws 中访问 Spring Boot Actuator(生产就绪功能)

java - 将json数据ajax传递给Spring boot