admin , front 수정 및 vm 수정
This commit is contained in:
@@ -6,7 +6,9 @@ import org.jasypt.iv.RandomIvGenerator;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class TestJasyptConfig {
|
||||
// 운영 서버만 옵션 비꾸기
|
||||
private String jasyptPassword = "etribe";
|
||||
private String jasyptPasswordPrd = "ko-research";
|
||||
|
||||
//PBEWithMD5AndDES
|
||||
//PBEWITHHMACSHA512ANDAES_256
|
||||
@@ -33,6 +35,50 @@ public class TestJasyptConfig {
|
||||
|
||||
System.out.println("encryptPassword : " + encryptPassword);
|
||||
Assertions.assertThat(password).isEqualTo(jasyptDecryt(encryptPassword));
|
||||
|
||||
|
||||
System.out.println("--------------------------------" );
|
||||
|
||||
System.out.println("운영서버 정보 엔코딩" );
|
||||
String url2 = "jdbc:postgresql://115.68.193.117:5432/korea_research";
|
||||
String encryptUrl2 = jasyptEncryptPrd(url2);
|
||||
|
||||
System.out.println("encryptUrl2 : " + encryptUrl2);
|
||||
Assertions.assertThat(url2).isEqualTo(jasyptDecrytPrd(encryptUrl2));
|
||||
|
||||
|
||||
String username2 = "etribe";
|
||||
String encryptUsername2 = jasyptEncryptPrd(username2);
|
||||
|
||||
System.out.println("encryptUsername2 : " + encryptUsername2);
|
||||
Assertions.assertThat(username2).isEqualTo(jasyptDecrytPrd(encryptUsername2));
|
||||
|
||||
|
||||
String password2 = "Etribe@3415";
|
||||
String encryptPassword2 = jasyptEncryptPrd(password2);
|
||||
System.out.println("encryptPassword2 : " + encryptPassword2);
|
||||
|
||||
System.out.println("--------------------------------" );
|
||||
|
||||
System.out.println("운영서버 정보 MMS 엔코딩" );
|
||||
String url3 = "jdbc:postgresql://115.68.193.117:5432/ppurio";
|
||||
String encryptUrl3 = jasyptEncryptPrd(url3);
|
||||
|
||||
System.out.println("encryptUrl3 : " + encryptUrl3);
|
||||
Assertions.assertThat(url3).isEqualTo(jasyptDecrytPrd(encryptUrl3));
|
||||
|
||||
|
||||
String username3 = "etribe";
|
||||
String encryptUsername3 = jasyptEncryptPrd(username3);
|
||||
|
||||
System.out.println("encryptUsername3 : " + encryptUsername3);
|
||||
Assertions.assertThat(username3).isEqualTo(jasyptDecrytPrd(encryptUsername3));
|
||||
|
||||
|
||||
String password3 = "Etribe@3415";
|
||||
String encryptPassword3 = jasyptEncryptPrd(password3);
|
||||
System.out.println("encryptPassword3 : " + encryptPassword3);
|
||||
|
||||
}
|
||||
|
||||
private String jasyptEncrypt(String input) {
|
||||
@@ -50,4 +96,21 @@ public class TestJasyptConfig {
|
||||
encryptor.setIvGenerator(new RandomIvGenerator());
|
||||
return encryptor.decrypt(input);
|
||||
}
|
||||
|
||||
|
||||
private String jasyptEncryptPrd(String input) {
|
||||
StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
|
||||
encryptor.setAlgorithm(jasyptAlgorithm);
|
||||
encryptor.setPassword(jasyptPasswordPrd);
|
||||
encryptor.setIvGenerator(new RandomIvGenerator());
|
||||
return encryptor.encrypt(input);
|
||||
}
|
||||
|
||||
private String jasyptDecrytPrd(String input){
|
||||
StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
|
||||
encryptor.setAlgorithm(jasyptAlgorithm);
|
||||
encryptor.setPassword(jasyptPasswordPrd);
|
||||
encryptor.setIvGenerator(new RandomIvGenerator());
|
||||
return encryptor.decrypt(input);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user