mirror of
https://github.com/Sneed-Group/pypush-plus-plus
synced 2024-10-30 16:37:52 +00:00
oops bug
This commit is contained in:
parent
3a946a152e
commit
10ddee20df
2 changed files with 8 additions and 5 deletions
|
@ -17,10 +17,10 @@ def connect(private_key=None, cert=None):
|
|||
# Wrap the socket in TLS
|
||||
sock = tlslite.TLSConnection(sock)
|
||||
# Parse the certificate and private key
|
||||
cert = tlslite.X509CertChain([tlslite.X509().parse(cert)])
|
||||
private_key = tlslite.parsePEMKey(private_key, private=True)
|
||||
cert_parsed = tlslite.X509CertChain([tlslite.X509().parse(cert)])
|
||||
private_key_parsed = tlslite.parsePEMKey(private_key, private=True)
|
||||
# Handshake with the server
|
||||
sock.handshakeClientCert(cert, private_key, alpn=ALPN)
|
||||
sock.handshakeClientCert(cert_parsed, private_key_parsed, alpn=ALPN)
|
||||
|
||||
return sock, private_key, cert
|
||||
|
||||
|
|
7
demo.py
7
demo.py
|
@ -1,5 +1,8 @@
|
|||
import apns
|
||||
from base64 import b64decode, b64encode
|
||||
|
||||
c = apns.APNSConnection()
|
||||
print(f"Push Token: {b64encode(c.token).decode()}")
|
||||
conn1 = apns.APNSConnection()
|
||||
print(f"Push Token 1: {b64encode(conn1.token).decode()}")
|
||||
|
||||
conn2 = apns.APNSConnection(cert=conn1.cert, private_key=conn1.private_key, token=conn1.token)
|
||||
print(f"Push Token 2: {b64encode(conn2.token).decode()}")
|
Loading…
Reference in a new issue