From 84170c571b7152eedbe50d7f055aedd034baea52 Mon Sep 17 00:00:00 2001 From: Laurent Date: Tue, 16 Jan 2024 10:31:07 +0100 Subject: [PATCH] load certif --- subscriptions/views.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/subscriptions/views.py b/subscriptions/views.py index 138c634..e2705f1 100644 --- a/subscriptions/views.py +++ b/subscriptions/views.py @@ -32,7 +32,7 @@ def app_store_webhook(request): fulljson = json.loads(decoded) signedPayload = fulljson['signedPayload'] - root_certificates = load_root_certificates() + root_certificates = _get_root_cert(None) enable_online_checks = True bundle_id = "stax.SlashPoker.nosebleed" environment = Environment.SANDBOX @@ -108,18 +108,18 @@ def app_store_webhook(request): # except (ValueError, KeyError, jwt.exceptions.PyJWTError, X509StoreContextError) as err: # raise InvalidTokenError from err # -# def _get_root_cert(root_cert_path): -# -# fn = os.environ.get("APPLE_ROOT_CA") -# if fn is None: -# fn = root_cert_path or "AppleRootCA-G3.cer" -# -# fn = os.path.expanduser(fn) -# with open(fn, "rb") as f: -# data = f.read() -# root_cert = load_certificate(FILETYPE_ASN1, data) -# -# return root_cert +def _get_root_cert(root_cert_path): + + fn = os.environ.get("APPLE_ROOT_CA") + if fn is None: + fn = root_cert_path or "AppleRootCA-G3.cer" + + fn = os.path.expanduser(fn) + with open(fn, "rb") as f: + data = f.read() + root_cert = load_certificate(FILETYPE_ASN1, data) + + return root_cert # # class InvalidTokenError(Exception): # pass