Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/155-Email encryption #156

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions src/main/java/GHOST/sk_ghost/config/JasyptConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@ public StringEncryptor stringEncryptor() {
encryptor.setPassword("password"); // 암호화 키 -> 암호화 및 복호화에 사용되는 키.. 실제 운영 환경에서는 이 password 도 가려야 함. (추후 txt파일에서 불러오기)
encryptor.setAlgorithm("PBEWithSHA256And128BitAES-CBC-BC"); // Bouncy Castle 라이브러리에서 제공하는 암호화 알고리즘들 중에서 사용할 알고리즘(PBE~)를 세팅

// 실제 암호화 수행
// 주의 : 암호화 수행 시 암호화된 코드가 변경되므로 동일 텍스트에 대해 두번수행하지 않도록 해야 합니다
// String db_text = "123"; //123은 암호화하고자 하는 문자열 예시
// String encrypted_db_text = encryptor.encrypt(db_text);
// System.out.println("Enc = " + encrypted_db_text);
//
// 암호화한 db_text 복호화 및 정상출력 확인
// String decryptedText = encryptor.decrypt(encrypted_db_text);
// System.out.println("Dec = " + decryptedText);

// 실제 암호화 수행
// 주의 : 암호화 수행 시 암호화된 코드가 변경되므로 동일 텍스트에 대해 두번수행하지 않도록 해야 합니다
/*
String db_text = "[email protected]"; //123은 암호화하고자 하는 문자열 예시
String encrypted_db_text = encryptor.encrypt(db_text);
System.out.println("Enc = " + encrypted_db_text);
*/

// 암호화한 db_text 복호화 및 정상출력 확인
/*
String decryptedText = encryptor.decrypt(encrypted_db_text);
System.out.println("Dec = " + decryptedText);
*/
return encryptor;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jasypt.encryptor.bean.suffix= )
# EmailAuth
spring.mail.host=smtp.gmail.com
spring.mail.port=587
spring.mail.username=[email protected]
spring.mail.password=ojlmaepmjaqbpmsw
spring.mail.username=ENC(+4luIeWqN1oxfmij+SJVBLO3pciDbmZzFPS+Q0gbq+NQYIiGSJ3oaSi8Gi8OrQaWaEoF6b0oMzI8ei5DIiMurw==)
spring.mail.password=ENC(qATVqGlhrHWDEE3PJwKWNYswNiYq+9TuVV1m6aKokieB/KyAVUIhDOW0LwEmFbWa)
spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.properties.mail.smtp.auth=true