-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
38 additions
and
7 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
28 changes: 28 additions & 0 deletions
28
BE/src/main/java/com/codesquad/airbnb/infra/config/JasyptConfig.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,28 @@ | ||
package com.codesquad.airbnb.infra.config; | ||
|
||
import org.jasypt.encryption.StringEncryptor; | ||
import org.jasypt.encryption.pbe.PooledPBEStringEncryptor; | ||
import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class JasyptConfig { | ||
|
||
String password = System.getenv("JASYPT_PASSWORD"); | ||
|
||
@Bean("jasyptStringEncryptor") | ||
public StringEncryptor stringEncryptor() { | ||
PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor(); | ||
SimpleStringPBEConfig config = new SimpleStringPBEConfig(); | ||
config.setPassword(password); // 암호화에 사용할 키 | ||
config.setAlgorithm("PBEWithMD5AndDES"); //사용할 알고리즘 | ||
config.setKeyObtentionIterations("1000"); | ||
config.setPoolSize("1"); | ||
config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator"); | ||
config.setStringOutputType("base64"); | ||
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
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