File tree 3 files changed +8
-6
lines changed
src/main/java/im/toss/cert/sdk
3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ JAVA 1.8버전 사용자들을 위한 세션키 발급 및 개인정보 암복
6
6
7
7
예시)
8
8
```
9
- <version>0.0.4 </version>
9
+ <version>0.0.5 </version>
10
10
```
11
11
12
12
pom.xml 을 사용하시면 아래와 같이 추가해주세요.
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ plugins {
6
6
}
7
7
8
8
group ' com.github.toss'
9
- version ' 0.0.4 '
9
+ version ' 0.0.5 '
10
10
11
11
sourceCompatibility = JavaVersion . VERSION_1_6
12
12
targetCompatibility = JavaVersion . VERSION_1_6
@@ -25,8 +25,8 @@ repositories {
25
25
26
26
dependencies {
27
27
implementation ' commons-codec:commons-codec:1.15'
28
- testImplementation ' org.junit.jupiter:junit-jupiter-api:5.8.2 '
29
- testRuntimeOnly ' org.junit.jupiter:junit-jupiter-engine:5.8.2 '
28
+ testImplementation ' org.junit.jupiter:junit-jupiter-api:5.9.0-M1 '
29
+ testRuntimeOnly ' org.junit.jupiter:junit-jupiter-engine:5.9.0-M1 '
30
30
31
31
}
32
32
Original file line number Diff line number Diff line change 5
5
import java .security .SecureRandom ;
6
6
7
7
class SecureKeyGenerator {
8
+ private static final SecureRandom secureRandom = new SecureRandom ();
9
+
8
10
static String generateKey (int aesKeyBitLength ) throws NoSuchAlgorithmException {
9
11
KeyGenerator keyGenerator = KeyGenerator .getInstance ("AES" );
10
- keyGenerator .init (aesKeyBitLength , new SecureRandom () );
12
+ keyGenerator .init (aesKeyBitLength , secureRandom );
11
13
return Base64Utils .encodeToString (keyGenerator .generateKey ().getEncoded ());
12
14
}
13
15
14
16
static String generateRandomBytes (int lengthInBits ) {
15
17
byte [] bytes = new byte [lengthInBits / 8 ];
16
- new SecureRandom () .nextBytes (bytes );
18
+ secureRandom .nextBytes (bytes );
17
19
return Base64Utils .encodeToString (bytes );
18
20
}
19
21
}
You can’t perform that action at this time.
0 commit comments