mirror of
https://gitee.com/willfree/min-dev-java.git
synced 2026-10-04 19:42:01 +08:00
fix:兼容go版本的sm2
This commit is contained in:
1 parent
70d20bbf3c
commit
273114a8da
2 files changed
+8
-6
No files matched your search
@@ -14,6 +14,7 @@ import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.bouncycastle.jce.spec.ECParameterSpec;
|
||||
import org.bouncycastle.math.ec.ECPoint;
|
||||
import org.bouncycastle.math.ec.custom.gm.SM2P256V1Curve;
|
||||
import org.bouncycastle.pqc.math.linearalgebra.ByteUtils;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.math.BigInteger;
|
||||
@@ -187,11 +188,11 @@ public class SM2Base {
|
||||
**/
|
||||
public static byte[] byteArraytoHexByteArray(byte[] bytes){
|
||||
// 16进制表示法
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for(int i=0;i < bytes.length;i++) {
|
||||
sb.append(String.format("%02x", bytes[i]));
|
||||
}
|
||||
String hexStr = sb.toString();
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// for(int i=0;i < bytes.length;i++) {
|
||||
// sb.append(String.format("%02x", bytes[i]));
|
||||
// }
|
||||
String hexStr = ByteUtils.toHexString(bytes);
|
||||
return hexStr.getBytes();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user