Commit 8f662ab7 authored by jiangpeng's avatar jiangpeng

cert:fmt code

parent 11657800
...@@ -91,7 +91,7 @@ func (validator *gmValidator) Validate(certByte []byte, pubKey []byte) error { ...@@ -91,7 +91,7 @@ func (validator *gmValidator) Validate(certByte []byte, pubKey []byte) error {
} }
if !bytes.Equal(pubKey, sm2_util.SerializePublicKey( if !bytes.Equal(pubKey, sm2_util.SerializePublicKey(
ParseECDSAPubKey2SM2PubKey(certPubKey), len(pubKey) == sm2_util.SM2PublicKeyCompressed)) { ParseECDSAPubKey2SM2PubKey(certPubKey), len(pubKey) == sm2_util.SM2PublicKeyCompressed)) {
return fmt.Errorf("Invalid public key") return fmt.Errorf("Invalid public key")
} }
......
...@@ -59,10 +59,10 @@ func CreateCertificateToPem(FileName string, template, parent *sm2.Certificate, ...@@ -59,10 +59,10 @@ func CreateCertificateToPem(FileName string, template, parent *sm2.Certificate,
defer file.Close() defer file.Close()
err = pem.Encode(file, block) err = pem.Encode(file, block)
if err != nil { if err != nil {
return err return err
} }
return nil return nil
} }
// ParseX509CertificateToSm2 解析x509格式为sm2格式证书 // ParseX509CertificateToSm2 解析x509格式为sm2格式证书
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment