title: Connecting to APNS for iPhone Using Python
body: <p>I'm trying to send push notifications to an iPhone using Python. I've exported my <strong>certificate and private key</strong> into a p12 file from keychain access and then converted it into pem file using the following command:</p>
  
  <pre><code>openssl pkcs12 -in cred.p12 -out cert.pem -nodes -clcerts
  </code></pre>
  
  <p>I'm using <a href="http://code.google.com/p/apns-python-wrapper/wiki/APNSWrapperOverview" rel="noreferrer">APNSWrapper</a> in Python for the connection. </p>
  
  <p>I run the following code:</p>
  
  <pre>
  deviceToken = 'Qun\xaa\xd ... c0\x9c\xf6\xca' 
  
  # create wrapper
  wrapper = APNSNotificationWrapper('/path/to/cert/cert.pem', True)
  
  # create message
  message = APNSNotification()
  message.token(deviceToken)
  message.badge(5)
  
  # add message to tuple and send it to APNS server
  wrapper.append(message)
  wrapper.notify()
  </pre>
  
  <p>And then I get the error message:</p>
  
  <pre>
  ssl.SSLError: (1, '_ssl.c:485: 
  error:14094416:SSL routines:SSL3_READ_BYTES:sslv3 alert certificate unknown')
  </pre>
  
  <p>Can anyone help me out on this? </p>