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

这里说明一下:

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

因为我们项目没有用springboot 2.0

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

jasypt-spring-boot修改加解密用得盐的key_第1张图片

项目加解密的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的版本比较

jasypt-spring-boot修改加解密用得盐的key_第2张图片

 

 

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

1 首先提示一个deploy错误是

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

查了google发现大致是xml里面

deploy得地址是官方得

如下:


        
            ossrh
            https://oss.sonatype.org/content/repositories/snapshots
        
        
            ossrh
            https://oss.sonatype.org/service/local/staging/deploy/maven2/
        
 

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

我们也把私服地址修改下


    
        releases
        http://192.168.1.184:8081/nexus/content/repositories/releases
    
    
        snapshots
        http://192.168.1.184:8081/nexus/content/repositories/snapshots
    

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

jasypt-spring-boot修改加解密用得盐的key_第3张图片

上述过程种还可能遇到

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. nexus-releases

  2. admin

  3. admin123

  4.  
  5. nexus-snapshots

  6. admin

  7. admin123

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

 

然后再次deploy 就可以了

jasypt-spring-boot修改加解密用得盐的key_第4张图片

你可能感兴趣的:(maven,开源组件)