jasypt-spring-boot修改加解密用得盐的key

这里说明一下:

使用得jasypt-spring-boot得版本是1.18

因为我们项目没有用springboot 2.0

拉取得是tag里面得一个分支。

项目加解密的key 盐值

用到的key 是 

jasypt.encryptor.password = yourkey

这个boot里面properties的jasypt.encryptor.password属性值,要配置到,两个选择

1 全局的配置中心 比如apollo的glabal common里面

2 或者每个项目组的各个项目里面都要单独配置一下)

很多人可以看到 这样就对保密性,不太好,

大家搜一下百度都知道 是盐,算法找下就可以反过来解密,

 

本文的目的就是给jasypt.encryptor.password 换个名字 比如看着不像是记录密钥的

举个例子

com.xxcompany.framework.info=xxcompany

xxcompany 其实就是盐 但是这样即使看着也隐蔽性很高

 

项目拉下来改好之后 ( 已经传github)

https://github.com/albertflyer/jasypt-spring-boot-jasypt-spring-boot-parent-1.18

涉及改动的地方 和官方1.18的版本比较

 

 

以下是deploy公司私服遇到的一些问题。

1 首先提示一个deploy错误是

nexus-staging-maven-plugin:1.6.8:deploy failed: Server credentials with ID "ossrh" not found! 

查了google发现大致是xml里面

deploy得地址是官方得

如下:

<distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
 </distributionManagement>

本来我们工程私服地址是配置在setting.xml里面管理得 这个既然放置在pom.xml

我们也把私服地址修改下

<distributionManagement>
    <repository>
        <id>releases</id>
        <url>http://192.168.1.184:8081/nexus/content/repositories/releases</url>
    </repository>
    <snapshotRepository>
        <id>snapshots</id>
        <url>http://192.168.1.184:8081/nexus/content/repositories/snapshots</url>
    </snapshotRepository>
</distributionManagement>

然后把源码里面涉及到ossrh得地方都拿掉.

上述过程种还可能遇到

Deployment failed: repository element was not specified in the POM inside distributionManagement ...

错误 参考 https://blog.csdn.net/weixin_34392435/article/details/87503329 上面其实也给出了解决方法

2 注意

 在maven的settings.xml文件中做如下配置:

 
  1. <server>

  2. <id>nexus-releases</id>

  3. <username>admin</username>

  4. <password>admin123</password>

  5. </server>

  6.  
  7. <server>

  8. <id>nexus-snapshots</id>

  9. <username>admin</username>

  10. <password>admin123</password>

  11. </server>

  注意这里配置的server的id必须和pom文件中的distributionManagement对应仓库的id保持一致,maven在处理发布时会根据id查找用户名称和密码进行登录和文件的上传发布。不然会报401授权错误。

 

然后再次deploy 就可以了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值