duanhongyi / gmssl

a python crypto for sm2/sm3/sm4
MIT License
488 stars 141 forks source link

[bug] sm2的public key lstrip有问题 #66

Open wklken opened 1 year ago

wklken commented 1 year ago

https://github.com/duanhongyi/gmssl/blob/master/gmssl/sm2.py#L25

self.public_key = public_key.lstrip("04") if public_key.startswith("04") else public_key

should be

self.public_key = public_key[2:] if public_key.startswith("04") else public_key