def sign_sha1(body, pri_key):
'''
sign body with pri_key by hash SHA1, return base64 bytes
body: binary
pur_key: binary
'''
rsa_pri = RSA.importKey(pri_key)
pk = PKCS1_v1_5.new(rsa_pri)
h = SHA.new(body)
cbs = pk.sign(h)
return base64.encodebytes(cbs)
评论列表
文章目录