mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
commit
e8885395f7
@ -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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user