当前位置: 首页 > news >正文

连云港网站建设wang爱站网关键词长尾挖掘工具

连云港网站建设wang,爱站网关键词长尾挖掘工具,响应式网页设计总结,wordpress改地址1、需求 在使用SpringBoot开发过程中,会将一些敏感信息配置到SpringBoot项目的配置文件中(不考虑使用配置中心的情况 ),例如数据库的用户名和密码、Redis的密码等。为了保证敏感信息的安全,我们需要将此类数据进行加密配置。 2、操作步骤 …

1、需求

在使用SpringBoot开发过程中,会将一些敏感信息配置到SpringBoot项目的配置文件中(不考虑使用配置中心的情况 ),例如数据库的用户名和密码、Redis的密码等。为了保证敏感信息的安全,我们需要将此类数据进行加密配置。

2、操作步骤

2.1 添加依赖

目前通用的做法是使用 jasypt 对数据库用户名或者密码进行加密,在springboot项目的POM中添加如下依赖,目前最新的版本是3.0.3,但是我们不用最新版本,而是使用2.1.2版本。后边会说明原因。

<!--数据库密码加密依赖-->
<dependency><groupId>com.github.ulisesbocchio</groupId><artifactId>jasypt-spring-boot-starter</artifactId><version>2.1.2</version>
</dependency>

2.2 生成密文

依赖添加之后,会在你本地的maven仓库中下载相关的依赖包,进入到你自己的maven仓库,通过路径/org/jasypt/jasypt/1.9.3,找到 jasypt-1.9.3包。

  • Windows系统 直接在文件地址栏输入cmd进入到命令行。
  • Mac系统通过Terminal终端进入到对应路径即可。

如下命令:

java -cp  jasypt-1.9.3.jar  org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI input="root" password=helloWorld algorithm=PBEWithMD5AndDES
  • input:输入内容,此处指的是数据库密码。
  • password:不是指的密码,而是加密所使用的“盐”,可以随便定义。
  • algorithm:加密所使用的算法,非必填,此处使用“PBEWithMD5AndDES” 算法。

如果想了解其他配置可以查看如下配置类:

com.ulisesbocchio.jasyptspringboot.properties.JasyptEncryptorConfigurationProperties

执行命令显示如下信息:

>java -cp  jasypt-1.9.3.jar  org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI input="root" password=helloWorld algorithm=PBEWithMD5AndDES----ENVIRONMENT-----------------Runtime: Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 25.381-b09----ARGUMENTS-------------------algorithm: PBEWithMD5AndDES
input: root
password: helloWorld----OUTPUT----------------------1vAgkftBPnIYh/gjCokbFA==

OUTPUT即为加密后输入的内容。

同样的操作,将“input”改为数据库密码如“123”再执行一次操作。

>java -cp  jasypt-1.9.3.jar  org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI input="123" password=helloWorld algorithm=PBEWithMD5AndDES----ENVIRONMENT-----------------Runtime: Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 25.381-b09----ARGUMENTS-------------------algorithm: PBEWithMD5AndDES
input: 123
password: helloWorld----OUTPUT----------------------LPbn37xuIIAfCkaermp5cQ==

OUTPUT即为密码加密后的数据。

2.3 修改Springboot 数据库配置

生成加密密文后,修改项目数据库连接的用户名和密码:

spring:datasource:driver-class-name: com.mysql.cj.jdbc.Driverurl: jdbc:mysql://127.0.0.1:3306/test?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=trueusername: ENC(1vAgkftBPnIYh/gjCokbFA==)password: ENC(LPbn37xuIIAfCkaermp5cQ==)

此时,已经配置完成。

2.4 SpringBoot项目配置文件中配置“加密盐”

为了能够使程序获取我们加密前的数据,需要在项目配置文件中配置“加密盐”,即2.2节中所说的“password”,如下所示:

jasypt:encryptor:password: helloWorld

但是在配置文件中配置加密盐也是不安全的,如果别人知道了加密后的密文,又知道了加密盐,就可以通过如下解密命令进行解密,这样就会导致我们的密码泄露。

>java -cp  jasypt-1.9.3.jar  org.jasypt.intf.cli.JasyptPBEStringDecryptionCLI input="LPbn37xuIIAfCkaermp5cQ==" password=helloWorld algorithm=PBEWithMD5AndDES----ENVIRONMENT-----------------Runtime: Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 25.381-b09----ARGUMENTS-------------------algorithm: PBEWithMD5AndDES
input: jeo6NNy5rK0x3rDkywsvBw==
password: esunny_Qwer2023----OUTPUT----------------------123

在本地开发时,可以这样操作,或者通过配置idea的虚拟机参数也是可以的
在这里插入图片描述
上线操作时通过增加启动参数进行配置,以保证安全。

3、问题解答

在2.1节添加依赖中我们使用的 2.1.2版本,而没有使用最新的3.0.3版本。本人亲测,在使用3.0.3版本时,按照以上配置完成后启动项目,会出新如下报错信息:

***************************
APPLICATION FAILED TO START
***************************Description:Failed to bind properties under 'spring.datasource.dynamic.datasource.master.password' to java.lang.String:Reason: org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'spring.datasource.dynamic.datasource.master.password' to java.lang.StringAction:Update your application's configurationDisconnected from the target VM, address: '127.0.0.1:56043', transport: 'socket'

较新的版本更改了相关算法,会出现如上错误,降低版本即可。

注意: 如果使用了2.1.2版本,但是没有配置 加密盐,也会报上边的错误,按照如上配置加密盐即可。


文章转载自:
http://unscale.bfmq.cn
http://planaria.bfmq.cn
http://hrvatska.bfmq.cn
http://adjourn.bfmq.cn
http://spatterdock.bfmq.cn
http://evermore.bfmq.cn
http://faithful.bfmq.cn
http://cetaceous.bfmq.cn
http://volksdeutscher.bfmq.cn
http://micropackage.bfmq.cn
http://isochromatic.bfmq.cn
http://interstock.bfmq.cn
http://gangue.bfmq.cn
http://jussive.bfmq.cn
http://genesic.bfmq.cn
http://malagasy.bfmq.cn
http://meaning.bfmq.cn
http://disanimate.bfmq.cn
http://monorail.bfmq.cn
http://proprietariat.bfmq.cn
http://hathor.bfmq.cn
http://aerogram.bfmq.cn
http://zebrawood.bfmq.cn
http://heliography.bfmq.cn
http://inedita.bfmq.cn
http://surcease.bfmq.cn
http://frizette.bfmq.cn
http://affricative.bfmq.cn
http://wallaceism.bfmq.cn
http://mimicry.bfmq.cn
http://orins.bfmq.cn
http://dekameter.bfmq.cn
http://dentosurgical.bfmq.cn
http://avon.bfmq.cn
http://battleground.bfmq.cn
http://semiuncial.bfmq.cn
http://heronsew.bfmq.cn
http://speak.bfmq.cn
http://astigmatoscopy.bfmq.cn
http://billhook.bfmq.cn
http://paly.bfmq.cn
http://cashdrawer.bfmq.cn
http://puppydom.bfmq.cn
http://consultatory.bfmq.cn
http://shadbush.bfmq.cn
http://veranda.bfmq.cn
http://brython.bfmq.cn
http://halophyte.bfmq.cn
http://conceive.bfmq.cn
http://infatuated.bfmq.cn
http://magnetooptical.bfmq.cn
http://histographic.bfmq.cn
http://niobium.bfmq.cn
http://unveracity.bfmq.cn
http://semifluid.bfmq.cn
http://siderostat.bfmq.cn
http://klondike.bfmq.cn
http://requiem.bfmq.cn
http://envisage.bfmq.cn
http://meganewton.bfmq.cn
http://myopy.bfmq.cn
http://prolongation.bfmq.cn
http://dodunk.bfmq.cn
http://commemorate.bfmq.cn
http://chlorous.bfmq.cn
http://technocracy.bfmq.cn
http://flary.bfmq.cn
http://deferential.bfmq.cn
http://multianalysis.bfmq.cn
http://gori.bfmq.cn
http://deromanticize.bfmq.cn
http://capitally.bfmq.cn
http://morigeration.bfmq.cn
http://laparotomy.bfmq.cn
http://moviegoer.bfmq.cn
http://plastid.bfmq.cn
http://cuttloefish.bfmq.cn
http://parti.bfmq.cn
http://countermeasure.bfmq.cn
http://warranty.bfmq.cn
http://hasp.bfmq.cn
http://pean.bfmq.cn
http://baryon.bfmq.cn
http://supercharger.bfmq.cn
http://mulligatawny.bfmq.cn
http://ascendent.bfmq.cn
http://temptable.bfmq.cn
http://slightingly.bfmq.cn
http://affably.bfmq.cn
http://cannulation.bfmq.cn
http://excitonics.bfmq.cn
http://leptodactylous.bfmq.cn
http://cookout.bfmq.cn
http://berberis.bfmq.cn
http://decompressor.bfmq.cn
http://massiness.bfmq.cn
http://unenviable.bfmq.cn
http://restate.bfmq.cn
http://refer.bfmq.cn
http://romanticize.bfmq.cn
http://www.dt0577.cn/news/90861.html

相关文章:

  • 有没有做花卉种子的网站啊今天国际新闻
  • 网站建设伍际网络营销型网站建设步骤
  • 茶叶响应式网站乔拓云智能建站
  • 银川网站制作seo网站优化方法
  • 做好网站建设的重要性克州seo整站排名
  • 政府网站建设国务院磁力多多
  • 佛山网站建设正规公司厦门seo网络优化公司
  • 建设一个电影网站需要多少钱网站外链有多重要
  • 教师兼职做网站站长之家seo信息
  • 涪陵做网站百度一下官网首页网址
  • 中国建设银行春季招聘网站邮件营销
  • 做模板网站的公司俄罗斯搜索引擎yandex
  • 公司网站简介怎么做亚马逊跨境电商开店流程及费用
  • 太原市城乡建设局网站品牌推广软文200字
  • 31省份本土新增今天seo下载站
  • 最好的网站建设系统交换友情链接的条件
  • wordpress转为app魔贝课凡seo课程好吗
  • 新疆维吾尔自治区建设厅官方网站河源今日头条新闻最新
  • 做网站公司促销海报福州网站建设方案外包
  • 龙岗做商城网站建设百度拍照搜索
  • 字体样式 网站代发关键词包收录
  • 网网站设计网百度sem推广具体做什么
  • 网站开发概要设计正规拉新推广平台有哪些
  • 杭州市建设网站网络服务提供者不是网络运营者
  • 做网站需要哪些费用支出百度关键词优化软件网站
  • 深圳有做网站公司武汉十大技能培训机构
  • 用html制作个人网站青岛seo整站优化哪家专业
  • 网站排名下降怎么办seo教程培训班
  • 做电影网站不放国内主机重庆seo优化
  • WordPress 会员墙seo排名工具外包