SpringCloud Config 非对称加密

1. 生成keystore

$ keytool -genkeypair -alias config-server-key -keyalg RSA \
  -dname "CN=ConfigServer,OU=Company,O=Organization,L=City,S=Province,C=China,S=Beijing" \
  -keypass 123456 \
  -keystore server.jks \
  -storepass 123456

2. 配置keystore

bootstrap.properties

encrypt.key-store.location=classpath:/server.jks
encrypt.key-store.alias=config-server-key
encrypt.key-store.password=123456
encrypt.key-store.secret=123456

3. 测试

curl localhost:7001/encrypt -d 111111

$ curl localhost:7001/decrypt -d AQCVnky53jfNVQkJdsryovOjbuTWOhh7C9HH6fx+5fAXtmD4xWIi86XwIVHF/2hlsa6xyvFioqwLSvmYeGgSA4qVBDr945NnxmfyiRM9BmuSSoQII32fHzmYI6/BM24IMv4CNHxCsvfqkHjJ6VZeZf6XMPr8i9mVq8v1+qrG3Y8ILp0BeKNwYhEMKqNcbdmZOE/eLlv8zimgeIAY3kvo4y8iUaGZj/1X2joLwUgYfyHw8TkohIAz2t29aCKYsM6PpBSDvBwZzQums77yhGI0Tw3KwAOFMsMMvVGTY7jYz7aAqLF8Kg4pemHrt2D+pX6E8BuXiku9TtkFSUgOwXkXtlwJYhycuHYN9LVKNH4YzmPjtqz80MsDjgOjjvK2iGoFPgI=

你可能感兴趣的:(SpringCloud Config 非对称加密)