Closed marijang closed 9 years ago
Seems your pem file has incorrect data, normally, you can just append key pem file into cert pem file and supply cert_file only. If your question is why APNS need cert and key? that's SSL certificate's nature to authenticate and decrypt/encrypt the data on both end. FYR.
So i can call like this?
apns = APNs(use_sandbox=True, cert_file='CertANDKeyProduction.pem')
Yes, you can.
i create pem on mac and my python instalation is on widows server. Do i need to generate pem on windows machine?
This is a support request, not a package bug, so I am closing.
For my code i get this error
Traceback (most recent call last): File "C:\env\test\sendpush.py", line 15, in
apns.gateway_server.send_notification(token_hex, payload)
File "C:\Python27\lib\site-packages\apns.py", line 536, in send_notification
self.write(self._get_notification(token_hex, payload))
File "C:\Python27\lib\site-packages\apns.py", line 270, in write
return self._connection().write(string)
File "C:\Python27\lib\site-packages\apns.py", line 252, in _connection
self._connect()
File "C:\Python27\lib\site-packages\apns.py", line 228, in _connect
self._ssl = wrap_socket(self._socket, self.key_file, self.cert_file)
File "C:\Python27\lib\ssl.py", line 891, in wrap_socket
ciphers=ciphers)
File "C:\Python27\lib\ssl.py", line 509, in init
self._context.load_cert_chain(certfile, keyfile)
ssl.SSLError: [SSL] PEM lib (_ssl.c:2506)
Why i need to have cert and key file?