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

怀化市住房和城乡建设局网站国内十大跨境电商平台

怀化市住房和城乡建设局网站,国内十大跨境电商平台,韩国的电商网站,如何建设国外的网站文章目录 前言一、集成 Jasypt1. pom 依赖2. yml 依赖 3. 加密工具类3. 使用二、常见问题1. application.yml 失效问题2. 配置热更新失败问题 前言 jasypt 官方地址#xff1a;https://github.com/ulisesbocchio/jasypt-spring-boot Jasypt可以为Springboot加密的信息很多https://github.com/ulisesbocchio/jasypt-spring-boot Jasypt可以为Springboot加密的信息很多主要有 System Property 系统变量。Envirnment Property 环境变量。Command Line argument 命令行参数。Application.properties 应用配置文件。Yaml properties 应用配置文件。other custom property sources 其它配置文件。 一、集成 Jasypt 1. pom 依赖 !-- jasyptyml加密 -- dependencygroupIdcom.github.ulisesbocchio/groupIdartifactIdjasypt-spring-boot-starter/artifactIdversion3.0.5/version /dependency2. yml 依赖 jasypt:encryptor:password: encpassword # 加密盐值自定义algorithm: PBEWithMD5AndDES # 加密算法3.0.5以下版本默认PBEWithMD5AndDES即DES加密算法-32位密文3.0.5及以上版本默认PBEWITHHMACSHA512ANDAES_256即AES加密算法-64位密文iv-generator-classname: org.jasypt.iv.NoIvGenerator # 加密偏移生成器3. 加密工具类 使用如下工具类对密码进行加密获取密文。 import lombok.extern.slf4j.Slf4j; import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;/*** jasyptyml加密工具** author whiteen* date 2024-06-20 00:00:00*/ Slf4j public class JasyptUtil {/*** DES加密** param original 待加密内容* param password 加密盐值* return 加密密文* author whiteen* date 2024-06-20 00:00:00*/public static String encryptByDes(String original, String password) {StandardPBEStringEncryptor encryptor new StandardPBEStringEncryptor();SimpleStringPBEConfig config new SimpleStringPBEConfig();// 设置盐值config.setPassword(password);config.setAlgorithm(PBEWithMD5AndDES);config.setIvGeneratorClassName(org.jasypt.iv.NoIvGenerator);encryptor.setConfig(config);// 加密return encryptor.encrypt(original);}/*** AES加密** param original 待加密内容* param password 加密盐值* return 加密密文* author whiteen* date 2024-06-20 00:00:00*/public static String encryptByAes(String original, String password) {StandardPBEStringEncryptor encryptor new StandardPBEStringEncryptor();SimpleStringPBEConfig config new SimpleStringPBEConfig();// 设置盐值config.setPassword(password);config.setAlgorithm(PBEWITHHMACSHA512ANDAES_256);config.setIvGeneratorClassName(org.jasypt.iv.RandomIvGenerator);encryptor.setConfig(config);// 加密return encryptor.encrypt(original);}/*** DES解密** param original 待解密内容* param password 加密盐值* return 加密明文* author whiteen* date 2024-06-20 00:00:00*/public static String decryptByDes(String original, String password) {StandardPBEStringEncryptor encryptor new StandardPBEStringEncryptor();SimpleStringPBEConfig config new SimpleStringPBEConfig();// 设置盐值config.setPassword(password);config.setAlgorithm(PBEWithMD5AndDES);config.setIvGeneratorClassName(org.jasypt.iv.NoIvGenerator);encryptor.setConfig(config);// 解密return encryptor.decrypt(original);}/*** AES解密** param original 待解密内容* param password 加密盐值* return 加密明文* author whiteen* date 2024-06-20 00:00:00*/public static String decryptByAes(String original, String password) {StandardPBEStringEncryptor encryptor new StandardPBEStringEncryptor();SimpleStringPBEConfig config new SimpleStringPBEConfig();// 设置盐值config.setPassword(password);config.setAlgorithm(PBEWITHHMACSHA512ANDAES_256);config.setIvGeneratorClassName(org.jasypt.iv.RandomIvGenerator);encryptor.setConfig(config);// 解密return encryptor.decrypt(original);}public static void main(String[] args) {// 待加密内容String original original;// 加密盐值String password encpassword;// DES加密String encryptedDes encryptByDes(original, password);log.info(DES密⽂: {}, encryptedDes);// DES解密String decryptedDes decryptByDes(encryptedDes, password);log.info(DES明⽂: {}, decryptedDes);// AES加密String encryptedAes encryptByAes(original, password);log.info(AES密⽂: {}, encryptedAes);// AES解密String decryptedAes decryptByAes(encryptedAes, password);log.info(AES明⽂: {}, decryptedAes);}} 3. 使用 password: ENC(${ORACLE_PWD:password})二、常见问题 1. application.yml 失效问题 如果你的项目存在 boostrap.yml 配置文件在引入 jasypt-spring-boot-starter 之后发现 application.yml 与 application-dev.yml 配置没有生效需要在 boostrap.yml 中设置 jasypt.encryptor.bootstrap 属性为 false禁用对 boostrap 配置文件的加密支持就可以解决 application.yml 与 application-dev.yml 配置失效的问题。 说明 当 jasypt 和 springcloud 一起使用时bootstrap 的配置会失效。追踪代码发现spring 在启动 bootstrap 容器后当把 bootstrap 容器的 environment 合并到子容器时只同步了 OriginTrackedMapPropertySource 类型 BootstrapApplicationListener此时所有的 PropertySource 都已经被包装为 EncryptablePropertySourceWrapper所以会导致 bootstrap 的配置不会合并到子容器。 2. 配置热更新失败问题 在 yml 配置文件中设置环境变量报错。 参考 apollo 跟 jasypt-spring-boot-2.1.0.jar 不兼容问题 https://github.com/apolloconfig/apollo/issues/2162 升级 jasypt-spring-boot-starter 到 3.0.5 及以上版本可以解决配置热更新问题再新增 algorithm 和 iv-generator-classname 两个配置即可 !-- jasyptyml加密 -- dependencygroupIdcom.github.ulisesbocchio/groupIdartifactIdjasypt-spring-boot-starter/artifactIdversion3.0.5/version /dependencyjasypt:encryptor:password: encpassword # 加密盐值自定义algorithm: PBEWithMD5AndDES # 加密算法3.0.5以下版本默认PBEWithMD5AndDES即DES加密算法-32位密文3.0.5及以上版本默认PBEWITHHMACSHA512ANDAES_256即AES加密算法-64位密文iv-generator-classname: org.jasypt.iv.NoIvGenerator # 加密偏移生成器这样就可以在 yml 配置文件中设置环境变量 password: ENC(${ORACLE_PWD:BBO5rGF40iSg5oG36MT5aEwpdrOe5f2})
http://www.hkea.cn/news/14561822/

相关文章:

  • 网站建设玖金手指排名14无锡网页设计培训公司
  • 大理住房和城乡建设部网站一台服务做两个网站
  • 深圳服装网站建设网页升级访问每天
  • 一级a做爰片 网站就能看产品市场推广途径
  • 郑州专业制作网站多少钱wordpress头部优化
  • 宝安网站建设定制阳江市问政平台举报
  • 网站后台为什么传不上图片网站开发的方法有哪些
  • 欧美风的网站设计网上商店的优势和缺陷
  • 市场策划网站抖音投放广告价格一览
  • 创建网站忘记了怎么办建设织梦网站模板
  • 黑彩网站建设运营wordpress收费下载模板
  • 培训机构 网站建设wordpress添加友情链接页面
  • 怎么自己做网站赚钱吗北京网站编程培训
  • 怎么学习制作网站百度搜索推广官网
  • 全网通网站建设网站群如何做网站
  • 建设工程安全备案网站平台公司和项目公司的区别
  • me域名网站做seo网站公司
  • 动易网站内容管理系统电视剧排行榜
  • 可以免费进入的网站正能量域名苏宁易购网站建设建议
  • 做网站 违法建设工程服务平台
  • 绍兴优秀做网站的wordpress用户上传
  • 酒店设计网站推荐网站建设杭州哪家便宜
  • 中文域名注册 .网站软考网络工程师中级
  • 中国商标注册网官方网站小程序代理是做什么的
  • 局网站建设情况一级a做爰片i网站
  • 莆田外贸网站建设推广网站开发实现页面的跳转
  • 网站网页优化怎么做云一网站建设
  • 什么网站可以接模具做网站建设-设计
  • 网站开发简单吗网址导航名词解释
  • 网站建设咨询公司地址如何将网站的关键词排名优化