You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/java/org/gmssl/crypto/symmetric/SM4CipherFactory.java
+19Lines changed: 19 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,9 @@
8
8
*/
9
9
packageorg.gmssl.crypto.symmetric;
10
10
11
+
importorg.gmssl.crypto.CipherPaddingEnum;
12
+
importorg.gmssl.crypto.PKCS7PaddingScheme;
13
+
11
14
importjava.security.NoSuchAlgorithmException;
12
15
13
16
/**
@@ -19,6 +22,11 @@
19
22
*/
20
23
publicclassSM4CipherFactory {
21
24
25
+
/**
26
+
* Create an SM4 encryption and decryption engine that supports ECB, CBC, CTR, and GCM modes.
27
+
* @param mode
28
+
* @return
29
+
*/
22
30
publicstaticSM4EnginecreateCipher(Stringmode){
23
31
SM4Enginecipher;
24
32
try {
@@ -44,4 +52,15 @@ public static SM4Engine createCipher(String mode){
44
52
returncipher;
45
53
}
46
54
55
+
/**
56
+
* Currently, only the PKCS7Padding padding mode for ECB algorithm mode is set. Other algorithms (SM4/CBC/PKCS5Padding, SM4/CTR/NoPadding, SM4/GCM/NoPadding) have their default padding implemented.
0 commit comments