Skip to content

Commit 4a0a854

Browse files
committed
Merge #77: [Bug] Fix SSL connections for macOS
9ea7664 update dependencies (Fuzzbawls) 6ef7a59 Use certifi package for SSL Certificates (Liquid369) Pull request description: macOS was inconsistently using a mix of (old) system + certifi SSL certificates, leading to RPC endpoint connection attempts resulting in invalid SSL certificate errors. This unifies all https connections to use certifi, which is provided at distribution time to be the latest available version, and disregard any potential stale system certificates. Replaces #73 Top commit has no ACKs. Tree-SHA512: 795c38a463ac40e99038a6dc1ac54795ba45a7ea87167fe5f735b8b4d4d306c0bc15f8a7d3784e20259cb3f84832f7c64d7878f16c546936a0f230c5f86e2805
2 parents 0fc400e + 9ea7664 commit 4a0a854

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

requirements.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
wheel==0.45.1
2-
setuptools==75.8.0
2+
setuptools==78.1.1
3+
certifi
34
python-bitcoinrpc==1.0
45
bitcoin==1.1.42
56
trezor==0.11.5
67
PyQt5>=5.15.10
7-
requests==2.32.2
8+
requests==2.32.5
89
simplejson==3.19.2
910
ecdsa==0.19.0
1011
importlib-metadata==4.13.0
1112
flake8==3.8.4
1213
vulture==2.3
13-
pyinstaller==6.12.0
14+
pyinstaller==6.16.0
1415
# btchip-python 0.1.32 with a patch to fix a malformed dependency
1516
# See https://github.com/LedgerHQ/btchip-python/pull/54
1617
https://github.com/PIVX-Project/btchip-python/archive/e13eab8b0e665bdc23ac4b3890d2a5742303c421.tar.gz

src/blockbookClient.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# file LICENSE.txt or http://www.opensource.org/licenses/mit-license.php.
66

77
import requests
8+
import certifi
89

910
from misc import getCallerName, getFunctionName, printException
1011

@@ -45,7 +46,7 @@ def checkResponse(self, method, param=""):
4546
url = f"{self.url}/api/{method}"
4647
if param != "":
4748
url += "/{param}"
48-
resp = requests.get(url, data={}, verify=True)
49+
resp = requests.get(url, data={}, verify=certifi.where())
4950
if resp.status_code == 200:
5051
data = resp.json()
5152
return data

src/cryptoIDClient.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from random import choice
88
import requests
9+
import certifi
910

1011
from misc import getCallerName, getFunctionName, printException
1112

@@ -51,7 +52,7 @@ def __init__(self, isTestnet=False):
5152
def checkResponse(self, parameters):
5253
key = choice(api_keys)
5354
parameters['key'] = key
54-
resp = requests.get(self.url, params=parameters)
55+
resp = requests.get(self.url, params=parameters, verify=certifi.where())
5556
if resp.status_code == 200:
5657
data = resp.json()
5758
return data

src/misc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,9 @@ def getFunctionName(inDecorator=False):
191191

192192
def getRemoteSPMTversion():
193193
import requests
194+
import certifi
194195
try:
195-
resp = requests.get("https://raw.githubusercontent.com/PIVX-Project/PIVX-SPMT/master/src/version.txt")
196+
resp = requests.get("https://raw.githubusercontent.com/PIVX-Project/PIVX-SPMT/master/src/version.txt", verify=certifi.where())
196197
if resp.status_code == 200:
197198
data = resp.json()
198199
return data['number']

src/rpcClient.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import http.client as httplib
1010
import ssl
1111
import threading
12+
import certifi
1213

1314
from constants import DEFAULT_PROTOCOL_VERSION, MINIMUM_FEE
1415
from misc import getCallerName, getFunctionName, printException, printDbg, now, timeThis
@@ -50,7 +51,9 @@ def __init__(self, rpc_protocol, rpc_host, rpc_user, rpc_password):
5051

5152
host, port = rpc_host.split(":")
5253
if rpc_protocol == "https":
53-
self.httpConnection = httplib.HTTPSConnection(host, port, timeout=20, context=ssl.create_default_context())
54+
ssl_context = ssl.create_default_context()
55+
ssl_context.load_verify_locations(cafile=certifi.where())
56+
self.httpConnection = httplib.HTTPSConnection(host, port, timeout=20, context=ssl_context)
5457
else:
5558
self.httpConnection = httplib.HTTPConnection(host, port, timeout=20)
5659

0 commit comments

Comments
 (0)