title: python: APNs SSLError
body: <p>I am trying to send push notifications to iPhone via python as described <a href="http://leenux.org.uk/2009/07/14/push-on-the-iphone/" rel="noreferrer">here</a> but I am getting the following error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;console&gt;", line 1, in &lt;module&gt;
    File "/home/omat/CA/server/ca/models.py", line 193, in push
      c.connect((host_name, 2195))
    File "/usr/lib/python2.6/ssl.py", line 307, in connect
      self.ca_certs)
  SSLError: [Errno 336265225] _ssl.c:337: error:140B0009:SSL routines:
    SSL_CTX_use_PrivateKey_file:PEM lib
  </code></pre>
  
  <p>The error is raised from within the python ssl module as the traceback says but the message doesn't sing to me. Any ideas on what might be wrong?</p>
  
  <p>Thanks,</p>
  
  <p>oMat</p>
  
  <p><strong>edit:</strong></p>
  
  <p>The certificate used is created from the certificate and the private key as follows:</p>
  
  <pre><code>openssl pkcs12 -clcerts -nokeys -out apns-dev-cert.pem -in apns-dev-cert.p12
  openssl pkcs12 -nocerts -out apns-dev-key.pem -in apns-dev-key.p12
  cat apns-dev-cert.pem apns-dev-key.pem &gt; apns-dev.pem
  </code></pre>