mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 12:16:20 +08:00
MAGIC - change to use interface
This commit is contained in:
parent
d8dc283187
commit
baca02c1c1
@ -2325,14 +2325,11 @@ func (c *Certificate) CreateCRL(rand io.Reader, priv interface{}, revokedCerts [
|
|||||||
signed := tbsCertListContents
|
signed := tbsCertListContents
|
||||||
var signature []byte
|
var signature []byte
|
||||||
if signatureAlgorithm.Algorithm.Equal(oidSignatureSM2WithSM3) {
|
if signatureAlgorithm.Algorithm.Equal(oidSignatureSM2WithSM3) {
|
||||||
privKey, ok := key.(*sm2.PrivateKey)
|
if smKey, ok := priv.(sm2.Signer); ok {
|
||||||
if !ok {
|
signature, err = smKey.SignWithSM2(rand, nil, signed)
|
||||||
ecKey, ok := key.(*ecdsa.PrivateKey)
|
} else {
|
||||||
if ok && ecKey.Curve == sm2.P256() {
|
return nil, errors.New("x509: require sm2 private key")
|
||||||
privKey, _ = new(sm2.PrivateKey).FromECPrivateKey(ecKey)
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
signature, err = privKey.SignWithSM2(rand, nil, signed)
|
|
||||||
} else {
|
} else {
|
||||||
if hashFunc != 0 {
|
if hashFunc != 0 {
|
||||||
h := hashFunc.New()
|
h := hashFunc.New()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user