【Spring Cloud Finchley.SR + Spring Boot 2.0.6】 Bus Encrypt

本文源码:https://github.com/axin1240101543/spring-cloud(有什么问题可以提issue给我,一起学习,共同进步。)

1、安装JCE

1.1、下载

https://cloud.spring.io/spring-cloud-static/Finchley.SR2/single/spring-cloud.html#_cloud_native_applications

1.2、替换

下载的jar文件:

jdk自带的文件:

路径:F:\Java\jdk1.8.0_151\jre\lib\security\policy\limited

2、Symmetric Encrypt

2.1、配置

2.2、加密

2.3、修改git配置文件

yml和properties格式不同(yml有单引号、properties没有):key: '{cipher}密文'    key= {cipher}密文

详情请查看官方文档:

https://cloud.spring.io/spring-cloud-static/Finchley.SR2/single/spring-cloud.html#_encryption_and_decryption_2

2.4、刷新配置

2.5、查看结果

3、Asymmetric Encrypt

3.1、生成秘钥库

keytool -genkeypair -alias mytestkey -keyalg RSA -dname "CN=Web Server,OU=Unit,O=Organization,L=City,S=State,C=US" -keypass changeme -keystore server.jks -storepass letmein

解析命令含义:

 

keytool -genkeypair -alias mytestkey -keyalg RSA -keypass changeme -keystore server.jks -storepass letmein

桌面生成jks文件:

Put the server.jks file in the classpath (for instance) and then, in your bootstrap.yml, for the Config Server, create the following settings:(将jks文件放入项目的resources目录下)

3.2、配置

3.3、加密

3.4、修改git配置文件

3.5、刷新配置

3.6、查看结果

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值