mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 20:26:19 +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
|
||||
var signature []byte
|
||||
if signatureAlgorithm.Algorithm.Equal(oidSignatureSM2WithSM3) {
|
||||
privKey, ok := key.(*sm2.PrivateKey)
|
||||
if !ok {
|
||||
ecKey, ok := key.(*ecdsa.PrivateKey)
|
||||
if ok && ecKey.Curve == sm2.P256() {
|
||||
privKey, _ = new(sm2.PrivateKey).FromECPrivateKey(ecKey)
|
||||
}
|
||||
if smKey, ok := priv.(sm2.Signer); ok {
|
||||
signature, err = smKey.SignWithSM2(rand, nil, signed)
|
||||
} else {
|
||||
return nil, errors.New("x509: require sm2 private key")
|
||||
}
|
||||
signature, err = privKey.SignWithSM2(rand, nil, signed)
|
||||
} else {
|
||||
if hashFunc != 0 {
|
||||
h := hashFunc.New()
|
||||
|
Loading…
x
Reference in New Issue
Block a user