fix: 설정파일 암호화 적용
parent
488393fdef
commit
731a293db9
@ -0,0 +1,44 @@
|
||||
package kr.xit.framework.core.config.ignore;
|
||||
|
||||
import org.jasypt.encryption.StringEncryptor;
|
||||
import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
|
||||
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
|
||||
import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class JasyptConfig {
|
||||
|
||||
@Bean(name = "jasyptStringEncryptor")
|
||||
public StringEncryptor stringEncryptor() {
|
||||
final String key = "xit5811807!@";
|
||||
PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
|
||||
SimpleStringPBEConfig config = new SimpleStringPBEConfig();
|
||||
config.setPassword(key);
|
||||
config.setAlgorithm("PBEWithMD5AndDES");
|
||||
config.setPoolSize("1");
|
||||
encryptor.setConfig(config);
|
||||
return encryptor;
|
||||
}
|
||||
|
||||
//FIXME : 설정의 암호화 필요시
|
||||
public static void main(String[] args) {
|
||||
StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
|
||||
encryptor.setAlgorithm("PBEWithMD5AndDES");
|
||||
encryptor.setPassword("xit5811807!@");
|
||||
String url = encryptor.encrypt("jdbc:log4jdbc:mariadb://211.119.124.122:3306/xplatform?useUnicode=true&characterEncoding=utf8serverTimezone=Asia/Seoul&useSSL=false");
|
||||
String id = encryptor.encrypt("root");
|
||||
String passwd = encryptor.encrypt("xit5811807");
|
||||
String decryptedPass = encryptor.decrypt(url);
|
||||
System.out.println(url);
|
||||
System.out.println(id);
|
||||
System.out.println(passwd);
|
||||
System.out.println(decryptedPass);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue