File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed
src/test/kotlin/com/yapp2app Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change 11package com.yapp2app
22
3- import org.jasypt.encryption.StringEncryptor
3+ import org.jasypt.encryption.pbe.PooledPBEStringEncryptor
4+ import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig
45import org.junit.jupiter.api.Test
5- import org.springframework.beans.factory.annotation.Autowired
6- import org.springframework.boot.test.context.SpringBootTest
76import org.springframework.test.context.ActiveProfiles
87
9- @SpringBootTest
108@ActiveProfiles(" test" )
11- class JasyptTest (@Autowired private val jasyptStringEncryptor : StringEncryptor ) {
9+ class JasyptTest {
10+
11+ private val jasyptStringEncryptor = PooledPBEStringEncryptor ().apply {
12+ setConfig(
13+ SimpleStringPBEConfig ().apply {
14+ password = " testPasswordForJasypt"
15+ algorithm = " PBEWithHmacSHA512AndAES_256"
16+ setKeyObtentionIterations(" 1000" )
17+ setPoolSize(" 1" )
18+ providerName = " SunJCE"
19+ setSaltGeneratorClassName(" org.jasypt.salt.RandomSaltGenerator" )
20+ setIvGeneratorClassName(" org.jasypt.iv.RandomIvGenerator" )
21+ stringOutputType = " base64"
22+ },
23+ )
24+ }
1225
1326 @Test
1427 fun jasyptGeneratTest () {
1528 println (" === Jasypt 암호화 유틸리티 ===" )
1629 println ()
1730
1831 // 기타 암호화할 값
19- val text = " 2uYKrIx7hFeZDoEyiXvWSY29TvSGfevQ "
32+ val text = " test_text "
2033 val encryptedText = jasyptStringEncryptor.encrypt(text)
2134 println (" 원본: $text " )
2235 println (" 암호화: ENC($encryptedText )" )
You can’t perform that action at this time.
0 commit comments