mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
fix test
This commit is contained in:
parent
d19e78b202
commit
6a3639a78e
@ -12,10 +12,12 @@ import cn.hutool.crypto.SecureUtil;
|
||||
import cn.hutool.crypto.SmUtil;
|
||||
import cn.hutool.crypto.asymmetric.KeyType;
|
||||
import cn.hutool.crypto.asymmetric.SM2;
|
||||
import org.bouncycastle.asn1.ASN1Integer;
|
||||
import org.bouncycastle.asn1.ASN1Sequence;
|
||||
import org.bouncycastle.crypto.engines.SM2Engine;
|
||||
import org.bouncycastle.crypto.params.ECPrivateKeyParameters;
|
||||
import org.bouncycastle.jcajce.spec.OpenSSHPrivateKeySpec;
|
||||
import org.bouncycastle.math.ec.ECPoint;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@ -318,6 +320,10 @@ public class SM2Test {
|
||||
@Test
|
||||
public void asn1DecryptTest(){
|
||||
final SM2 sm2 = SmUtil.sm2("00dc7651c8473110a83215bfd26f37e306b2b99b02da9a4af9b9bd12e6360849bd", null);
|
||||
final ASN1Sequence decode = (ASN1Sequence) ASN1Util.decode(ResourceUtil.getStream("asn1.key"));
|
||||
final ASN1Sequence asn1 = (ASN1Sequence) ASN1Util.decode(ResourceUtil.getStream("asn1.key"));
|
||||
|
||||
ASN1Integer x = (ASN1Integer) asn1.getObjectAt(0);
|
||||
ASN1Integer y = (ASN1Integer) asn1.getObjectAt(1);
|
||||
final ECPoint point = SmUtil.SM2_DOMAIN_PARAMS.getCurve().createPoint(x.getValue(), y.getValue());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user