mirror of
https://github.com/WeiYe-Jing/datax-web.git
synced 2026-06-30 21:17:37 +08:00
commit
83ddcc2856
@ -104,11 +104,11 @@
|
||||
</dependency>
|
||||
|
||||
<!-- 数据库加密 -->
|
||||
<dependency>
|
||||
<groupId>com.github.ulisesbocchio</groupId>
|
||||
<artifactId>jasypt-spring-boot-starter</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</dependency>
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>com.github.ulisesbocchio</groupId>-->
|
||||
<!--<artifactId>jasypt-spring-boot-starter</artifactId>-->
|
||||
<!--<version>2.0.0</version>-->
|
||||
<!--</dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
|
||||
@ -1,42 +1,42 @@
|
||||
package com.wugui.datax.admin.util;
|
||||
|
||||
|
||||
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
|
||||
import org.jasypt.encryption.pbe.config.EnvironmentPBEConfig;
|
||||
|
||||
public class JasyptUtil {
|
||||
|
||||
final String algorithm = "PBEWithMD5AndDES";// 加密的算法,这个算法是默认的
|
||||
final String password = "hVO0O2NeySpANQUk"; // 加密的密钥 配置文件中 jasypt.encryptor.password
|
||||
StandardPBEStringEncryptor standardPBEStringEncryptor;
|
||||
|
||||
{
|
||||
standardPBEStringEncryptor = new StandardPBEStringEncryptor();
|
||||
EnvironmentPBEConfig config = new EnvironmentPBEConfig();
|
||||
config.setAlgorithm(algorithm);
|
||||
config.setPassword(password);
|
||||
standardPBEStringEncryptor.setConfig(config);
|
||||
}
|
||||
|
||||
public String encrypt(String plainText) {
|
||||
return standardPBEStringEncryptor.encrypt(plainText);
|
||||
}
|
||||
|
||||
//解密
|
||||
public String decrypt(String encryptedText) {
|
||||
return standardPBEStringEncryptor.decrypt(encryptedText);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
JasyptUtil test = new JasyptUtil();
|
||||
// System.out.println(test.decrypt("k6vl6SNCrZ8hyTcK4ew+pQ=="));
|
||||
// System.out.println(test.decrypt("nFNBAlHJtaE5tz9yKEqYSA=="));
|
||||
|
||||
System.out.println(test.encrypt("root"));
|
||||
System.out.println(test.encrypt("mysql"));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//package com.wugui.datax.admin.util;
|
||||
//
|
||||
//
|
||||
//import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
|
||||
//import org.jasypt.encryption.pbe.config.EnvironmentPBEConfig;
|
||||
//
|
||||
//public class JasyptUtil {
|
||||
//
|
||||
// final String algorithm = "PBEWithMD5AndDES";// 加密的算法,这个算法是默认的
|
||||
// final String password = "hVO0O2NeySpANQUk"; // 加密的密钥 配置文件中 jasypt.encryptor.password
|
||||
// StandardPBEStringEncryptor standardPBEStringEncryptor;
|
||||
//
|
||||
// {
|
||||
// standardPBEStringEncryptor = new StandardPBEStringEncryptor();
|
||||
// EnvironmentPBEConfig config = new EnvironmentPBEConfig();
|
||||
// config.setAlgorithm(algorithm);
|
||||
// config.setPassword(password);
|
||||
// standardPBEStringEncryptor.setConfig(config);
|
||||
// }
|
||||
//
|
||||
// public String encrypt(String plainText) {
|
||||
// return standardPBEStringEncryptor.encrypt(plainText);
|
||||
// }
|
||||
//
|
||||
// //解密
|
||||
// public String decrypt(String encryptedText) {
|
||||
// return standardPBEStringEncryptor.decrypt(encryptedText);
|
||||
// }
|
||||
//
|
||||
// public static void main(String[] args) {
|
||||
// JasyptUtil test = new JasyptUtil();
|
||||
//// System.out.println(test.decrypt("k6vl6SNCrZ8hyTcK4ew+pQ=="));
|
||||
//// System.out.println(test.decrypt("nFNBAlHJtaE5tz9yKEqYSA=="));
|
||||
//
|
||||
// System.out.println(test.encrypt("root"));
|
||||
// System.out.println(test.encrypt("mysql"));
|
||||
//
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
||||
@ -3,8 +3,8 @@ server:
|
||||
spring:
|
||||
#数据源
|
||||
datasource:
|
||||
username: ENC(6WpAwrc9TXkZo2aIXeYtHw==)
|
||||
password: ENC(flGBggksQibhINCvRmntzw==)
|
||||
username: root
|
||||
password: mysql
|
||||
url: jdbc:mysql://localhost:3306/datax_web?serverTimezone=Asia/Shanghai&useLegacyDatetimeCode=false&useSSL=false&nullNamePatternMatchesAll=true&useUnicode=true&characterEncoding=UTF-8
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
|
||||
@ -38,9 +38,9 @@ spring:
|
||||
socketFactory:
|
||||
class: javax.net.ssl.SSLSocketFactory
|
||||
|
||||
jasypt:
|
||||
encryptor:
|
||||
password: hVO0O2NeySpANQUk
|
||||
#jasypt:
|
||||
# encryptor:
|
||||
# password: hVO0O2NeySpANQUk
|
||||
|
||||
|
||||
management:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user