Config Server实现对称加密

一 新建项目microservice-config-server-encryption
二 application.yml的配置文件如下
server:
  port: 8080
spring:
  application:
    name: microservice-config-server
  cloud:
    config:
      server:
        git:
          uri:https://git.oschina.net/itmuch/spring-cloud-config-repo# 配置Git仓库的地址
          username:                                                         # Git仓库的账号
          password:                                                         # Git仓库的密码
encrypt:
  key: foo  # 设置对称密钥
三 测试
C:\WINDOWS\system32>curl http://localhost:8080/encrypt -d mysecret
852e5d33a2763aa920b974e1db06b603f3cc7ea6771aa12f0548676afb7cc534
C:\WINDOWS\system32>curl http://localhost:8080/decrypt -d 852e5d33a2763aa920b974e1db06b603f3cc7ea6771aa12f0548676afb7cc534
mysecret

猜你喜欢

转载自blog.csdn.net/chengqiuming/article/details/80872181