duanhongyi / gmssl

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

TypeError: 'NoneType' object is not subscriptable #71

Open boothua-cloud opened 1 year ago

boothua-cloud commented 1 year ago

多次签名和验签,会出现如下错误:

Traceback (most recent call last):
  File "/Users/yid/Documents/Workspace/Haiyu/MpcAgentBackend/test.py", line 22, in <module>
    jiemi()
  File "/Users/yid/Documents/Workspace/Haiyu/MpcAgentBackend/test.py", line 17, in jiemi
    print(encrypt.verify('jello', sign))
  File "/Users/yid/Documents/Workspace/Haiyu/MpcAgentBackend/common/encrypt/encrypt.py", line 62, in verify
    return self._actuators.verify(plain_text, signature)
  File "/Users/yid/Documents/Workspace/Haiyu/MpcAgentBackend/common/encrypt/encrypt_sm2.py", line 54, in verify
    return self._sm2_crypt.verify(signature, plain_text.encode(encoding='utf-8'))
  File "/opt/anaconda3/envs/MpcAgentBackend/lib/python3.9/site-packages/gmssl/sm2.py", line 183, in verify
    x = int(P1[0:self.para_len], 16)
TypeError: 'NoneType' object is not subscriptable