0001-paybox-pass-bytes-to-hashing-function-37212.patch
eopayment/paybox.py | ||
---|---|---|
22 | 22 |
import warnings |
23 | 23 | |
24 | 24 |
from .common import (PaymentCommon, PaymentResponse, FORM, PAID, ERROR, Form, |
25 |
ORDERID_TRANSACTION_SEPARATOR, ResponseError, force_text) |
|
25 |
ORDERID_TRANSACTION_SEPARATOR, ResponseError, force_text, force_byte)
|
|
26 | 26 | |
27 | 27 |
__all__ = ['sign', 'Payment'] |
28 | 28 | |
... | ... | |
142 | 142 |
def verify(data, signature, key=PAYBOX_KEY): |
143 | 143 |
'''Verify signature using SHA1withRSA by Paybox''' |
144 | 144 |
key = RSA.importKey(key) |
145 |
h = SHA.new(data)
|
|
145 |
h = SHA.new(force_byte(data))
|
|
146 | 146 |
verifier = PKCS1_v1_5.new(key) |
147 | 147 |
return verifier.verify(h, signature) |
148 | 148 |
tests/test_paybox.py | ||
---|---|---|
248 | 248 |
OWzAMDm/xsCWRvvel4GGixgm3aQRUPyTrlm4Ksy32Ya0rNnEDMAvB3dxOn7cp8GR |
249 | 249 |
ZdzrudBlevZXpr6iYwIDAQAB |
250 | 250 |
-----END PUBLIC KEY-----''' |
251 |
data = b'coin\n'
|
|
251 |
data = 'coin\n' |
|
252 | 252 |
sig64 = '''VCt3sgT0ecacmDEWWNVXJ+jGmIPBMApK42tBJV0FlDjpllOGPy8MsAmLW4/QjTtx |
253 | 253 |
z0Dkz0NjxvU+5WzQZh9Uuxr/egRCwV4NMRWqu0zaVVioeBvl4/5CWm4f4/1L9+0m |
254 | 254 |
FBFKOZhgBJnkC+l6+XhT4aYWKaQ4ocmOMV92yjeXTE4=''' |
255 |
- |