diff --git a/cds-platform-2025.V1/ruoyi-admin/src/main/java/org/dromara/util/JasyptUtil.java b/cds-platform-2025.V1/ruoyi-admin/src/main/java/org/dromara/util/JasyptUtil.java new file mode 100644 index 0000000..93a5456 --- /dev/null +++ b/cds-platform-2025.V1/ruoyi-admin/src/main/java/org/dromara/util/JasyptUtil.java @@ -0,0 +1,35 @@ +package org.dromara.util; +import org.jasypt.encryption.pbe.PooledPBEStringEncryptor; +import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig; +/** + * package: org.dromara.util + * creat_user: xiao_cp + * creat_date: 2025/8/27 + * creat_time: 15:17 + * description: + **/ +public class JasyptUtil { + public static void main(String[] args) { + PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor(); + SimpleStringPBEConfig config = new SimpleStringPBEConfig(); + + // 设置加密密钥(与配置中使用的密钥一致) + config.setPassword("66668888"); // 替换为你的密钥 + // 设置算法 + config.setAlgorithm("PBEWithHMACSHA512AndAES_256"); + config.setKeyObtentionIterations("1000"); + config.setPoolSize("1"); + config.setProviderName("SunJCE"); + config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator"); + config.setIvGeneratorClassName("org.jasypt.iv.RandomIvGenerator"); + config.setStringOutputType("base64"); + encryptor.setConfig(config); + + String plainText = "123456"; // 替换为你的数据库明文密码 + String encryptedText = encryptor.encrypt(plainText); + System.out.println("Encrypted password: ENC(" + encryptedText + ")"); + + // 如需解密验证,可使用下面一行 + // System.out.println("Decrypted: " + encryptor.decrypt(encryptedText)); + } +} diff --git a/cds-platform-2025.V1/ruoyi-admin/src/main/resources/application-dev.yml b/cds-platform-2025.V1/ruoyi-admin/src/main/resources/application-dev.yml index 21a5cb8..62f28f1 100644 --- a/cds-platform-2025.V1/ruoyi-admin/src/main/resources/application-dev.yml +++ b/cds-platform-2025.V1/ruoyi-admin/src/main/resources/application-dev.yml @@ -52,7 +52,8 @@ spring: #url: jdbc:mysql://localhost:3306/cdsdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true url: jdbc:mysql://101.42.2.210:3306/cdsdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true username: root - password: c12321456 + #password: c12321456 + password: ENC(s/jC75JXj3bcSLJe3+9ML0JhKPEN6iz1U57Q0n4zei0fi/DCNagIX41osRheliDD) # # 从库数据源 # slave: # lazy: true @@ -105,7 +106,9 @@ spring.data: # 数据库索引 database: 0 # redis 密码必须配置 - password: 123456 #TongRDS->cfg.xml->Listen.Secure2或3需要密码(RedisPassword),其他不需要 + #---TongRDS->cfg.xml->Listen.Secure2或3需要密码(RedisPassword),其他不需要 + #password: 123456 + password: ENC(6KdUNjp+dcCOa916uBD8QRPij7eGHovGlYLPN6bqCl3wjCctb3JMLi000jB6UFL7) # 连接超时时间 timeout: 10s # 是否开启ssl diff --git a/cds-platform-2025.V1/ruoyi-admin/src/main/resources/application.yml b/cds-platform-2025.V1/ruoyi-admin/src/main/resources/application.yml index 746bbbf..0ea5a66 100644 --- a/cds-platform-2025.V1/ruoyi-admin/src/main/resources/application.yml +++ b/cds-platform-2025.V1/ruoyi-admin/src/main/resources/application.yml @@ -81,7 +81,8 @@ spring: # 设置总上传的文件大小 max-request-size: 100MB #指定上传文件的临时目录,必须带,否则tongweb会报错 - location: /data/upload_tmp + ###注意,windows下tongweb此目录默认在domain空间下,需要手工创建,麒麟V10需要再验证!!!!! + location: /home/mps1/data/tmpdata mvc: # 设置静态资源路径 防止所有请求都去查静态资源 static-path-pattern: /static/** @@ -292,3 +293,17 @@ warm-flow: - 255,205,23 ## 已办理 - 157,255,0 + +jasypt: + encryptor: + # 加密算法,3.0.x版本推荐使用更安全的算法 + algorithm: PBEWithHMACSHA512AndAES_256 + # 初始化向量生成器,使用 AES 等算法时需要 + iv-generator-classname: org.jasypt.iv.RandomIvGenerator + # 盐生成器 + salt-generator-classname: org.jasypt.salt.RandomSaltGenerator + # 输出类型 + string-output-type: base64 + + #开发测试使用,上线部署时务必删除 + password: 66668888 diff --git a/cds-platform-2025.V1/ruoyi-admin/src/main/resources/logback-plus.xml b/cds-platform-2025.V1/ruoyi-admin/src/main/resources/logback-plus.xml index d22a8e6..9f3e02c 100644 --- a/cds-platform-2025.V1/ruoyi-admin/src/main/resources/logback-plus.xml +++ b/cds-platform-2025.V1/ruoyi-admin/src/main/resources/logback-plus.xml @@ -1,6 +1,6 @@ - + diff --git a/cds-platform-2025.V1/ruoyi-common/ruoyi-common-web/pom.xml b/cds-platform-2025.V1/ruoyi-common/ruoyi-common-web/pom.xml index cca93b0..e72b3d9 100644 --- a/cds-platform-2025.V1/ruoyi-common/ruoyi-common-web/pom.xml +++ b/cds-platform-2025.V1/ruoyi-common/ruoyi-common-web/pom.xml @@ -49,6 +49,12 @@ 8.0.9.03 <!– 按实际版本调整 –> --> + + com.github.ulisesbocchio + jasypt-spring-boot-starter + 3.0.5 + + org.springframework.boot spring-boot-starter-actuator