Merge branch 'v5-dev' of github.com:dromara/hutool into v5-dev

This commit is contained in:
Looly
2022-02-21 01:14:02 +08:00

View File

@@ -20,6 +20,7 @@ import org.bouncycastle.crypto.signers.PlainDSAEncoding;
import org.bouncycastle.crypto.signers.SM2Signer; import org.bouncycastle.crypto.signers.SM2Signer;
import org.bouncycastle.crypto.signers.StandardDSAEncoding; import org.bouncycastle.crypto.signers.StandardDSAEncoding;
import org.bouncycastle.util.BigIntegers; import org.bouncycastle.util.BigIntegers;
import org.bouncycastle.util.encoders.Hex;
import java.math.BigInteger; import java.math.BigInteger;
import java.security.PrivateKey; import java.security.PrivateKey;
@@ -521,7 +522,7 @@ public class SM2 extends AbstractAsymmetricCrypto<SM2> {
* @since 5.5.9 * @since 5.5.9
*/ */
public byte[] getD() { public byte[] getD() {
return BigIntegers.asUnsignedByteArray(getDBigInteger()); return BigIntegers.asUnsignedByteArray(32,getDBigInteger());
} }
/** /**
@@ -531,7 +532,7 @@ public class SM2 extends AbstractAsymmetricCrypto<SM2> {
* @since 5.7.17 * @since 5.7.17
*/ */
public String getDHex() { public String getDHex() {
return String.format("%064x", new BigInteger(1, getD())); return new String(Hex.encode(getD()));
} }
/** /**