load certificate with password
Readded because the last commit removed this.
This commit is contained in:
committed by
Sergey Petrov
parent
ae835a195f
commit
7783520dc3
+1
-1
@@ -33,7 +33,7 @@ class APNsClient(object):
|
||||
|
||||
def __init__(self, credentials, use_sandbox=False, use_alternative_port=False, proto=None, json_encoder=None, password=None):
|
||||
if credentials is None or isinstance(credentials, str):
|
||||
self.__credentials = CertificateCredentials(credentials)
|
||||
self.__credentials = CertificateCredentials(credentials, password)
|
||||
else:
|
||||
self.__credentials = credentials
|
||||
self._init_connection(use_sandbox, use_alternative_port, proto)
|
||||
|
||||
@@ -31,9 +31,9 @@ class Credentials(object):
|
||||
|
||||
# Credentials subclass for certificate authentication
|
||||
class CertificateCredentials(Credentials):
|
||||
def __init__(self, cert_file):
|
||||
def __init__(self, cert_file, password=None):
|
||||
ssl_context = init_context()
|
||||
ssl_context.load_cert_chain(cert_file)
|
||||
ssl_context.load_cert_chain(cert_file, password=password)
|
||||
super(CertificateCredentials, self).__init__(ssl_context)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user