Skip to content
This repository has been archived by the owner on Nov 19, 2018. It is now read-only.

SSL Error on push using PEM development certificate #5

Closed
kjf opened this issue Nov 27, 2014 · 10 comments
Closed

SSL Error on push using PEM development certificate #5

kjf opened this issue Nov 27, 2014 · 10 comments

Comments

@kjf
Copy link

kjf commented Nov 27, 2014

I generated a PEM certificate using the instructions in the README and all seemed to work ok. However, when I try to push the notification using the pem development certificate if receive the following error in my terminal.

This is with the ruby houston gem:

/Users/Kevin/.rvm/gems/ruby-2.1.2/gems/houston-2.2.1/lib/houston/connection.rb:42:in `initialize': SSL_CTX_use_PrivateKe
y: key values mismatch (OpenSSL::SSL::SSLError)
        from /Users/Kevin/.rvm/gems/ruby-2.1.2/gems/houston-2.2.1/lib/houston/connection.rb:42:in `new'
        from /Users/Kevin/.rvm/gems/ruby-2.1.2/gems/houston-2.2.1/lib/houston/connection.rb:42:in `open'
        from /Users/Kevin/.rvm/gems/ruby-2.1.2/gems/houston-2.2.1/lib/houston/connection.rb:19:in `open'
        from /Users/Kevin/.rvm/gems/ruby-2.1.2/gems/houston-2.2.1/lib/houston/client.rb:40:in `push'
        from push_it.rb:22:in `<main>'

I also tried with the ruby grocer gem to be sure it's not a ruby issue and received the same error.

/Users/Kevin/.rvm/gems/ruby-2.1.2/gems/grocer-0.5.0/lib/grocer/ssl_connection.rb:41:in `initialize': SSL_CTX_use_Private
Key: key values mismatch (OpenSSL::SSL::SSLError)
        from /Users/Kevin/.rvm/gems/ruby-2.1.2/gems/grocer-0.5.0/lib/grocer/ssl_connection.rb:41:in `new'
        from /Users/Kevin/.rvm/gems/ruby-2.1.2/gems/grocer-0.5.0/lib/grocer/ssl_connection.rb:41:in `connect'
        from /Users/Kevin/.rvm/gems/ruby-2.1.2/gems/grocer-0.5.0/lib/grocer/connection.rb:29:in `connect'
        from /Users/Kevin/.rvm/gems/ruby-2.1.2/gems/grocer-0.5.0/lib/grocer/connection.rb:55:in `with_connection'
        from /Users/Kevin/.rvm/gems/ruby-2.1.2/gems/grocer-0.5.0/lib/grocer/connection.rb:23:in `write'
        from /Users/Kevin/.rvm/gems/ruby-2.1.2/gems/grocer-0.5.0/lib/grocer/pusher.rb:8:in `push'
        from push_it.rb:41:in `<main>'

My hand generated pem file works just fine.

@KrauseFx
Copy link
Contributor

That looks weird. Here is the code, which generates the profile for you: cert_manager.rb

How is it different from what you do when you create one manually?

@kjf
Copy link
Author

kjf commented Nov 27, 2014

These are my manual steps in creating a cert:

  • In developer portal click on create cert and follow those instructions to upload my CertificateSigningRequest.certSigningRequest
  • Download apple generated .cer file
  • Double click cer file to import into keychain
  • Find cert in keychain, right click and export as "development.p12" not setting any password
  • Run "openssl pkcs12 -in development.p12 -out development.pem -nodes -clcerts"
  • Use .pem file to send push notification

I'm not too great on openssl but it would seem my openssl command is differing in that I'm omitting the -passin flag and including the -clcerts flag

@KrauseFx
Copy link
Contributor

It looks like there is some problem with your private key. What does the QuickLook plugin tell you (if you have it installed)?

@KrauseFx
Copy link
Contributor

Okay, it looks like I have the same problem when running it. I seem to have broken it somehow - it worked before. I assume this is somehow related to the temporary Keychain.

@KrauseFx
Copy link
Contributor

This is fixed with the latest release: https://github.com/KrauseFx/PEM/releases/tag/0.2.0

Please update using sudo gem update pem and try again. Let me know if that fixes your problem.

@kjf
Copy link
Author

kjf commented Nov 28, 2014

Hey, just testing this now and I get an error when generating the .cer file.

INFO [2014-11-28 21:54:52.69]: Couldn't find a signing certificate in the current folder. Creating one for you now.
INFO [2014-11-28 21:54:52.88]: Successfully generated .certSigningRequest at path '/tmp/PEM/PEMCertificateSigningRequest.certSigningRequest'
/Users/Kevin/.rvm/gems/ruby-2.1.2/gems/pem-0.2.1/lib/pem/developer_center.rb:252:in `create_push_for_app': undefined method `set' for nil:NilClass (NoMethodError)
        from /Users/Kevin/.rvm/gems/ruby-2.1.2/gems/pem-0.2.1/lib/pem/developer_center.rb:211:in `fetch_cer_file'
        from /Users/Kevin/.rvm/gems/ruby-2.1.2/gems/pem-0.2.1/lib/pem/cert_manager.rb:12:in `run'
        from /Users/Kevin/.rvm/gems/ruby-2.1.2/gems/pem-0.2.1/bin/pem:38:in `block (2 levels) in <top (required)>'
        from /Users/Kevin/.rvm/gems/ruby-2.1.2/gems/commander-4.2.1/lib/commander/command.rb:180:in `call'
        from /Users/Kevin/.rvm/gems/ruby-2.1.2/gems/commander-4.2.1/lib/commander/command.rb:180:in `call'
        from /Users/Kevin/.rvm/gems/ruby-2.1.2/gems/commander-4.2.1/lib/commander/command.rb:155:in `run'
        from /Users/Kevin/.rvm/gems/ruby-2.1.2/gems/commander-4.2.1/lib/commander/runner.rb:421:in `run_active_command'
        from /Users/Kevin/.rvm/gems/ruby-2.1.2/gems/commander-4.2.1/lib/commander/runner.rb:81:in `run!'
        from /Users/Kevin/.rvm/gems/ruby-2.1.2/gems/commander-4.2.1/lib/commander/delegates.rb:8:in `run!'
        from /Users/Kevin/.rvm/gems/ruby-2.1.2/gems/commander-4.2.1/lib/commander/import.rb:10:in `block in <top (required)>'

error1417211692

@KrauseFx
Copy link
Contributor

Oh, looks like wait_for_elements(".button.small.center.back") is not enough for this page.
I'll improve that. In the mean time just try to run it again. The page was just still loading.

@KrauseFx
Copy link
Contributor

This is not related to the original issue. I'm currently working on a fix of this problem.

@KrauseFx
Copy link
Contributor

Could you please download the current version as zip, and run sudo rake install and try again?

@fastlanebot
Copy link

This issue was migrated to fastlane/fastlane#2845. Please post all further comments there.

fastlane is now a mono repo, you can read more about the change in our blog post. All tools are now available in the fastlane main repo 🚀

@fastlane-old fastlane-old locked and limited conversation to collaborators Mar 11, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants