This commit is contained in:
Looly 2020-09-14 21:11:32 +08:00
parent 999c1d80d4
commit ddd173a17c
2 changed files with 26 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package cn.hutool.crypto.test.asymmetric;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.lang.Console;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.HexUtil;
import cn.hutool.core.util.StrUtil;
@ -220,9 +221,12 @@ public class SM2Test {
final ECPrivateKeyParameters ecPrivateKeyParameters = ECKeyUtil.toSm2PrivateParams(d);
final SM2 sm2 = new SM2(ecPrivateKeyParameters, ecPublicKeyParameters);
sm2.setMode(SM2Engine.Mode.C1C2C3);
final String encryptHex = sm2.encryptHex(data, KeyType.PublicKey);
Console.log(encryptHex);
final String decryptStr = sm2.decryptStr(encryptHex, KeyType.PrivateKey);
Assert.assertEquals(data, decryptStr);
}
}

View File

@ -0,0 +1,22 @@
package cn.hutool.json;
import lombok.Data;
import org.junit.Assert;
import org.junit.Test;
public class Issue1075Test {
@Test
public void test() {
String s = "{\"f1\":\"f1\",\"F2\":\"f2\",\"fac\":\"fac\"}";
ObjA o2 = JSONUtil.parseObj(s, JSONConfig.create().setIgnoreCase(true)).toBean(ObjA.class);
Assert.assertEquals("fac", o2.getFAC());
}
@Data
public static class ObjA {
private String f1;
private String F2;
private String FAC;
}
}