remove length

This commit is contained in:
Looly
2022-03-17 20:53:36 +08:00
parent c500c43890
commit b0605b55ba
3 changed files with 22 additions and 1 deletions

View File

@@ -74,6 +74,20 @@ public class SmTest {
Assert.assertEquals(content, decryptStr);
}
@Test
public void sm4TestWithCustomKeyTest2() {
String content = "test中文frfewrewrwerwer---------------------------------------------------";
byte[] key = KeyUtil.generateKey(SM4.ALGORITHM_NAME, 128).getEncoded();
SM4 sm4 = SmUtil.sm4(key);
Assert.assertEquals("SM4", sm4.getCipher().getAlgorithm());
String encryptHex = sm4.encryptHex(content);
String decryptStr = sm4.decryptStr(encryptHex, CharsetUtil.CHARSET_UTF_8);
Assert.assertEquals(content, decryptStr);
}
@Test
public void hmacSm3Test() {
String content = "test中文";