From 3b6e1dcc4ccfdefa70575c23bc5d944271c92d65 Mon Sep 17 00:00:00 2001 From: Sergey Petrov Date: Tue, 9 May 2017 22:57:34 +0300 Subject: [PATCH] Added capability to pass in cert-key tuple instead of chain certificate file to the APNs client Close #26 --- apns2/credentials.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apns2/credentials.py b/apns2/credentials.py index a26a617..734c9c6 100644 --- a/apns2/credentials.py +++ b/apns2/credentials.py @@ -31,9 +31,10 @@ class Credentials(object): # Credentials subclass for certificate authentication class CertificateCredentials(Credentials): - def __init__(self, cert_file, password=None): - ssl_context = init_context() - ssl_context.load_cert_chain(cert_file, password=password) + def __init__(self, cert_file=None, password=None, cert_chain=None): + ssl_context = init_context(cert=cert_file, cert_password=password) + if cert_chain: + ssl_context.load_cert_chain(cert_chain) super(CertificateCredentials, self).__init__(ssl_context)