|
@@ -3,8 +3,10 @@ package com.its.traf;
|
|
|
import com.its.traf.dto.its.IfscCngsDto;
|
|
|
import com.its.traf.global.eTrafPrcsJob;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
|
|
|
+import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;
|
|
|
+import org.jasypt.salt.StringFixedSaltGenerator;
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
-import org.springframework.test.context.ActiveProfiles;
|
|
|
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
@@ -12,7 +14,7 @@ import java.util.*;
|
|
|
|
|
|
@Slf4j
|
|
|
//@SpringBootTest
|
|
|
-@ActiveProfiles(profiles = "dev")
|
|
|
+//@ActiveProfiles(profiles = "dev")
|
|
|
public class TrafPrcsServerApplicationTests {
|
|
|
|
|
|
enum LogLevel {
|
|
@@ -23,6 +25,40 @@ public class TrafPrcsServerApplicationTests {
|
|
|
ERROR,
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ void jasypt() {
|
|
|
+ String encKey = "asdkjfaslkjflkajslfjkajlkf";
|
|
|
+ PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
|
|
|
+ SimpleStringPBEConfig config = new SimpleStringPBEConfig();
|
|
|
+
|
|
|
+ // ==> SimpleStringPBEConfig 사용시 아래 3개 반드시 설정해야함
|
|
|
+ config.setPassword(encKey); // 암호화에 사용할 키
|
|
|
+ config.setPoolSize(1); // Pool Size
|
|
|
+ config.setSaltGenerator(new StringFixedSaltGenerator("fixedSalt")); // 고정으로 암호화(Default: Random)
|
|
|
+ //config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator");
|
|
|
+ //config.setAlgorithm("PBEWithMD5AndTripleDES");
|
|
|
+ config.setAlgorithm("PBEWithMD5AndDES"); // Jasypt 를 이용한 암호화 알고리즘
|
|
|
+ config.setProviderName("SunJCE");
|
|
|
+ config.setKeyObtentionIterations("10000");
|
|
|
+ config.setStringOutputType("base64");
|
|
|
+ /*private Boolean proxyPropertySources = false;
|
|
|
+ private String bean = "jasyptStringEncryptor";
|
|
|
+ private String password;
|
|
|
+ private String algorithm = "PBEWithMD5AndDES";
|
|
|
+ private String keyObtentionIterations = "1000";
|
|
|
+ private String poolSize = "1";
|
|
|
+ private String providerName = null;
|
|
|
+ //config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator");
|
|
|
+ private String saltGeneratorClassname = "org.jasypt.salt.RandomSaltGenerator";
|
|
|
+ private String stringOutputType = "base64";*/
|
|
|
+ encryptor.setConfig(config);
|
|
|
+
|
|
|
+ String yiits = encryptor.encrypt("adits");
|
|
|
+ String rota = encryptor.encrypt("rota");
|
|
|
+ log.info("{}", yiits);
|
|
|
+ log.info("{}", rota);
|
|
|
+ }
|
|
|
+
|
|
|
public String getCurr05MinString(Date paramDt) {
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
cal.setTime(paramDt);
|