Skip to content

Commit

Permalink
兼容微信支付签名探测流量
Browse files Browse the repository at this point in the history
  • Loading branch information
minibear2021 committed Dec 13, 2023
1 parent 4bd9aa0 commit 74aff4f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
6 changes: 6 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [1.2.43] - 2023-12-13

### Fixed

- 兼容微信支付签名探测流量

## [1.2.42] - 2023-11-15

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name="wechatpayv3",
version="1.2.42",
version="1.2.43",
author="minibear",
description="微信支付 API v3 Python SDK(python sdk for wechatpay v3)",
long_description=long_description,
Expand Down
5 changes: 4 additions & 1 deletion wechatpayv3/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ def rsa_verify(timestamp, nonce, body, signature, certificate):
sign_str = '%s\n%s\n%s\n' % (timestamp, nonce, body)
public_key = certificate.public_key()
message = sign_str.encode('UTF-8')
signature = b64decode(signature)
try:
signature = b64decode(signature)
except:
return False
try:
public_key.verify(signature, message, PKCS1v15(), SHA256())
except InvalidSignature:
Expand Down

0 comments on commit 74aff4f

Please sign in to comment.