tanghc 5 years ago
parent e8b251ddb8
commit f2e6ea6201
  1. 7
      sop-sdk/sdk-python/common/SignUtil.py

@ -85,7 +85,7 @@ def sign(content, private_key, sign_type):
raise Exception('sign_type错误') raise Exception('sign_type错误')
def rsa_sign(content, private_key, hash): def rsa_sign(content, private_key, _hash):
"""SHAWithRSA """SHAWithRSA
:param content: 签名内容 :param content: 签名内容
@ -94,9 +94,12 @@ def rsa_sign(content, private_key, hash):
:param private_key: 私钥 :param private_key: 私钥
:type private_key: str :type private_key: str
:param _hash: hash算法SHA-1,SHA-256
:type _hash: str
:return: 签名内容 :return: 签名内容
:rtype: str :rtype: str
""" """
pri_key = rsa.PrivateKey.load_pkcs1(private_key.encode('utf-8')) pri_key = rsa.PrivateKey.load_pkcs1(private_key.encode('utf-8'))
sign_result = rsa.sign(content, pri_key, hash) sign_result = rsa.sign(content, pri_key, _hash)
return base64.b64encode(sign_result) return base64.b64encode(sign_result)

Loading…
Cancel
Save