springBoot配置文件密码加密(jasypt)

博客直接给出代码,介绍了密码加密相关内容,包括引入依赖包、生成加密后的密码,涉及加密方式、明文密码、盐值等要素,还提到了配置文件。

简单粗暴,直接上代码

  1. 引入依赖包
<dependency>
    <groupId>com.github.ulisesbocchio</groupId>
    <artifactId>jasypt-spring-boot-starter</artifactId>
    <version>1.16</version>
</dependency>
  1. 生成加密后的密码
C:\Users\admin>java -cp C:\Users\admin\.m2\repository\org\jasypt\jasypt\1.9.2\jasypt-1.9.2.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI input="123456" password=1ab1cd2ef4hd algorithm=PBEWithMD5AndDES

----ENVIRONMENT-----------------

Runtime: Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 25.121-b13

----ARGUMENTS-------------------

algorithm: PBEWithMD5AndDES
input: 123456
password: 1ab1cd2ef4hd


----OUTPUT----------------------

yEV66fWm/1goY0/y8VRhNg==

algorithm:加密方式
input:明文密码
password:盐值
OUTPUT:加密后的密码
3. 配置文件

spring:
  datasource: 
    driver-class-name: oracle.jdbc.OracleDriver
    url: jdbc:oracle:thin:@127.0.0.1:1521/test
    username: test
    password: ENC(yEV66fWm/1goY0/y8VRhNg==) #ENC(密文)
jasypt:
  encryptor:
    password: 1ab1cd2ef4hd                  #盐值
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值