mirror of
https://gitee.com/BDWare/gmhelper
synced 2026-02-02 09:59:25 +00:00
fix BigInteger overflow
This commit is contained in:
@@ -379,8 +379,8 @@ public class SM2Util extends GMBaseUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ASN1Encodable[] arr = new ASN1Encodable[4];
|
ASN1Encodable[] arr = new ASN1Encodable[4];
|
||||||
arr[0] = new ASN1Integer(c1x);
|
arr[0] = new ASN1Integer(new BigInteger(1,c1x));
|
||||||
arr[1] = new ASN1Integer(c1y);
|
arr[1] = new ASN1Integer(new BigInteger(1,c1y));
|
||||||
if (mode == Mode.C1C2C3) {
|
if (mode == Mode.C1C2C3) {
|
||||||
arr[2] = new DEROctetString(c2);
|
arr[2] = new DEROctetString(c2);
|
||||||
arr[3] = new DEROctetString(c3);
|
arr[3] = new DEROctetString(c3);
|
||||||
@@ -414,6 +414,8 @@ public class SM2Util extends GMBaseUtil {
|
|||||||
byte[] c1y = ((ASN1Integer) as.getObjectAt(1)).getValue().toByteArray();
|
byte[] c1y = ((ASN1Integer) as.getObjectAt(1)).getValue().toByteArray();
|
||||||
byte[] c3;
|
byte[] c3;
|
||||||
byte[] c2;
|
byte[] c2;
|
||||||
|
c1x = fixToCurveLengthBytes(c1x);
|
||||||
|
c1y = fixToCurveLengthBytes(c1y);
|
||||||
if (mode == Mode.C1C2C3) {
|
if (mode == Mode.C1C2C3) {
|
||||||
c2 = ((DEROctetString) as.getObjectAt(2)).getOctets();
|
c2 = ((DEROctetString) as.getObjectAt(2)).getOctets();
|
||||||
c3 = ((DEROctetString) as.getObjectAt(3)).getOctets();
|
c3 = ((DEROctetString) as.getObjectAt(3)).getOctets();
|
||||||
|
|||||||
Reference in New Issue
Block a user