Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pem file without certificates blows up hard #57

Open
grant-olson opened this issue Jan 22, 2015 · 0 comments
Open

pem file without certificates blows up hard #57

grant-olson opened this issue Jan 22, 2015 · 0 comments

Comments

@grant-olson
Copy link

So I've been stumbling around the web trying to make APN keys. This involved running a lot of openssl commands by just cut-and-pasting things I saw on the web, without really understanding what I was doing. The fault is entirely mine, but I generated a .pem file that only had my encrypted RSA keys, and not my X509 certificates.

The retry logic in APNS.with_connection really flipped out here, and it got to the point where it even killed my db connection.

If would be nice if there was better handling of the error when it happened here:

context = OpenSSL::SSL::SSLContext.new
context.cert = OpenSSL::X509::Certificate.new(File.read(self.pem))
context.key = OpenSSL::PKey::RSA.new(File.read(self.pem), self.pass)

And instead of retrying when getting an error like:

2.1.4 :003 > OpenSSL::X509::Certificate.new(File.read("./radius-apn-production.pem.old"))
OpenSSL::X509::CertificateError: nested asn1 error
    from (irb):3:in `initialize'
    from (irb):3:in `new'
    from (irb):3
    from /Users/grant/.rvm/rubies/ruby-2.1.4/bin/irb:11:in `<main>'

pushmeup said that I had a bad/incomplete .pem file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant