Last active
April 7, 2020 08:13
-
-
Save ksundong/8d3c266897dd184a85508cd70c3cd8ec to your computer and use it in GitHub Desktop.
Jasypt 설정
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
// 참고 https://elfinlas.github.io/2017/12/21/jsaypt/ | |
@Configuration | |
public class JasyptConfig { | |
@Bean("jasyptStringEncryptor") | |
public StringEncryptor stringEncryptor() { | |
PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor(); | |
SimpleStringPBEConfig config = new SimpleStringPBEConfig(); | |
config.setPassword("sign-up"); // 암호화 키 값<서버의 환경변수로 설정해줘야함> | |
config.setAlgorithm("PBEWithMD5AndDES"); // 사용할 알고리즘 | |
config.setKeyObtentionIterations("1000"); // 해싱을 반복할 횟수 | |
config.setPoolSize("1"); // Encryptor를 클론하여 가지고 있을 갯수 | |
config.setProviderName("SunJCE"); // Default 값? | |
config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator"); // Salt를 생성하는 클래스 | |
config.setStringOutputType("base64"); // 인코딩 될 값 hexadecimal도 사용가능 | |
encryptor.setConfig(config); | |
return encryptor; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment