paybox: pass bytes to hashing function (#37212)
This commit is contained in:
parent
c5bd2265a2
commit
bf00e72309
|
@ -22,7 +22,7 @@ import string
|
|||
import warnings
|
||||
|
||||
from .common import (PaymentCommon, PaymentResponse, FORM, PAID, ERROR, Form,
|
||||
ORDERID_TRANSACTION_SEPARATOR, ResponseError, force_text)
|
||||
ORDERID_TRANSACTION_SEPARATOR, ResponseError, force_text, force_byte)
|
||||
|
||||
__all__ = ['sign', 'Payment']
|
||||
|
||||
|
@ -142,7 +142,7 @@ def sign(data, key):
|
|||
def verify(data, signature, key=PAYBOX_KEY):
|
||||
'''Verify signature using SHA1withRSA by Paybox'''
|
||||
key = RSA.importKey(key)
|
||||
h = SHA.new(data)
|
||||
h = SHA.new(force_byte(data))
|
||||
verifier = PKCS1_v1_5.new(key)
|
||||
return verifier.verify(h, signature)
|
||||
|
||||
|
|
|
@ -248,7 +248,7 @@ UX4D2A/QcMvkEcRVXFx5tQqcE9/JnMqE41TF/ebn7jC/MBxxtPFkUN7+EZoeMN7x
|
|||
OWzAMDm/xsCWRvvel4GGixgm3aQRUPyTrlm4Ksy32Ya0rNnEDMAvB3dxOn7cp8GR
|
||||
ZdzrudBlevZXpr6iYwIDAQAB
|
||||
-----END PUBLIC KEY-----'''
|
||||
data = b'coin\n'
|
||||
data = 'coin\n'
|
||||
sig64 = '''VCt3sgT0ecacmDEWWNVXJ+jGmIPBMApK42tBJV0FlDjpllOGPy8MsAmLW4/QjTtx
|
||||
z0Dkz0NjxvU+5WzQZh9Uuxr/egRCwV4NMRWqu0zaVVioeBvl4/5CWm4f4/1L9+0m
|
||||
FBFKOZhgBJnkC+l6+XhT4aYWKaQ4ocmOMV92yjeXTE4='''
|
||||
|
|
Loading…
Reference in New Issue