-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test: 암호화 처리 코드 테스트 작성 * feat: dev 환경 설정 파일 수정 * feat: encrypt 의존성 추가 * feat: dev codedeploy 설정 변경
- Loading branch information
1 parent
5c69f08
commit f32f9d4
Showing
8 changed files
with
87 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
36 changes: 36 additions & 0 deletions
36
src/main/java/org/devcourse/resumeme/global/config/PropertiesConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.devcourse.resumeme.global.config; | ||
|
||
import org.jasypt.encryption.StringEncryptor; | ||
import org.jasypt.encryption.pbe.PooledPBEStringEncryptor; | ||
import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Profile; | ||
|
||
@Profile("dev") | ||
@Configuration | ||
public class PropertiesConfig { | ||
|
||
@Value("${jasypt.encryptor.password}") | ||
private String password; | ||
|
||
@Bean("jasyptStringEncryptor") | ||
public StringEncryptor stringEncryptor() { | ||
SimpleStringPBEConfig config = new SimpleStringPBEConfig(); | ||
config.setPassword(password); | ||
config.setAlgorithm("PBEWithMD5AndDES"); | ||
config.setKeyObtentionIterations("1000"); | ||
config.setPoolSize("1"); | ||
config.setProviderName("SunJCE"); | ||
config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator"); | ||
config.setIvGeneratorClassName("org.jasypt.iv.NoIvGenerator"); | ||
config.setStringOutputType("base64"); | ||
|
||
PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor(); | ||
encryptor.setConfig(config); | ||
|
||
return encryptor; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule secret
updated
from 6f2395 to d77f46
35 changes: 35 additions & 0 deletions
35
src/test/java/org/devcourse/resumeme/common/EncryptTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.devcourse.resumeme.common; | ||
|
||
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; | ||
import org.junit.jupiter.api.Disabled; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class EncryptTest { | ||
|
||
@Test | ||
@Disabled | ||
void 프로퍼티_파일_값을_암호화_하는데_사용한다() { | ||
StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor(); | ||
|
||
encryptor.setPassword(""); | ||
encryptor.setAlgorithm("PBEWithMD5AndDES"); | ||
encryptor.setStringOutputType("base64"); | ||
|
||
String url = ""; | ||
String username = ""; | ||
String password = ""; | ||
String urlResult = encryptor.encrypt(url); | ||
String usernameResult = encryptor.encrypt(username); | ||
String passwordReesult = encryptor.encrypt(password); | ||
|
||
System.out.println("url plain : " + encryptor.decrypt(urlResult)); | ||
System.out.println("url encoding : " + urlResult); | ||
|
||
System.out.println("username plain : " + encryptor.decrypt(usernameResult)); | ||
System.out.println("username encoding : " + usernameResult); | ||
|
||
System.out.println("password plain : " + encryptor.decrypt(passwordReesult)); | ||
System.out.println("password encoding : " + passwordReesult); | ||
} | ||
|
||
} |