Commit 11657800 authored by jiangpeng's avatar jiangpeng

cert:verify sm2 pubkey with compression check

parent a07739a4
...@@ -90,7 +90,8 @@ func (validator *gmValidator) Validate(certByte []byte, pubKey []byte) error { ...@@ -90,7 +90,8 @@ func (validator *gmValidator) Validate(certByte []byte, pubKey []byte) error {
return fmt.Errorf("Error publick key type in transaction. expect SM2") return fmt.Errorf("Error publick key type in transaction. expect SM2")
} }
if !bytes.Equal(pubKey, sm2_util.SerializePublicKey(ParseECDSAPubKey2SM2PubKey(certPubKey))) { if !bytes.Equal(pubKey, sm2_util.SerializePublicKey(
ParseECDSAPubKey2SM2PubKey(certPubKey), len(pubKey) == sm2_util.SM2PublicKeyCompressed)) {
return fmt.Errorf("Invalid public key") return fmt.Errorf("Invalid public key")
} }
......
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