GarettRogers / appengine-apns-gcm

A unified push service for iPhone and Android push notifications that runs on Google App Engine (GAE).
112 stars 25 forks source link

Unable to parse private key #3

Closed amenon closed 11 years ago

amenon commented 11 years ago

Thanks for creating this project. I am developing an APN module to work on AppEngine and am using similar code to your apn.py. However, I run into an issue when the socket tries to connect: SSLError: _ssl module: Unable to parse private key.

My private key is a string that contains -----BEGIN RSA PRIVATE KEY----- to -----END RSA PRIVATE KEY----- and I pass the StingIO.StringIO of this string as the keyfile.

Am I missing anything?

GarettRogers commented 11 years ago

Make sure you include the -----BEGIN PRIVATE KEY----- and -----END PRIVATE KEY----- ... it will give you the error your are seeing if you don't. Let me know if that works

andidol commented 11 years ago

I'm getting the same error.

SSLError: _ssl module: Unable to parse private key.

Tried with -----BEGIN PRIVATE KEY----- and -----BEGIN RSA PRIVATE KEY----- ... what was the solution?

amenon commented 10 years ago

Make sure the RSA key is not encrypted. To identify whether a private key is encrypted or not, view the contents of the key. If it is encrypted, then the text ENCRYPTED appears in the first line.

You can use openssl to decrypt the key: openssl rsa –in enc.key -out dec.key

aggarwalanku commented 10 years ago

I am getting the same error , unable to debug it . I am copying all the contents of certificate in sandbox certificate field and public key in sandbox key. Please help

NoMan2000 commented 9 years ago

Make sure that it's the right type of SSH key. I'm on Windows, and the Putty Keys (ppk) will not work. Convert it to OpenSSL and make sure it has the correct signatures.

-----BEGIN RSA PRIVATE KEY-----

-----END RSA PRIVATE KEY-----

odednoam commented 9 years ago

To my horror, adding "\n" at the end of the file (after END PRIVATE KEY) fixed it for me