tboyko / apple_shove

Multi-Certificate APN Service Provider. More powerful than Apple Push...
MIT License
17 stars 7 forks source link

Unclear how to make .p12 file #1

Closed pctj101 closed 11 years ago

pctj101 commented 11 years ago

Exported p12 file such as: https://www.evernote.com/shard/s79/sh/f616230d-1224-488e-9a0e-7e022982cdb4/249aceb26db9419d14b4722f625372bf

With no password.

When using to get token feedback, I get an error such as:

   irb(main):004:0* tokens_array = AppleShove.feedback_tokens(apns_p12)
   OpenSSL::X509::CertificateError: nested asn1 error
        from /usr/local/lib/ruby/gems/2.0.0/gems/apple_shove-1.0.2/lib/apple_shove/apns/connection.rb:38:in `initialize'
        from /usr/local/lib/ruby/gems/2.0.0/gems/apple_shove-1.0.2/lib/apple_shove/apns/connection.rb:38:in `new'
        from /usr/local/lib/ruby/gems/2.0.0/gems/apple_shove-1.0.2/lib/apple_shove/apns/connection.rb:38:in `connect'
        from /usr/local/lib/ruby/gems/2.0.0/gems/apple_shove-1.0.2/lib/apple_shove/apns/connection.rb:17:in `socket'
        from /usr/local/lib/ruby/gems/2.0.0/gems/apple_shove-1.0.2/lib/apple_shove/apns/feedback_connection.rb:15:in `device_tokens'
        from /usr/local/lib/ruby/gems/2.0.0/gems/apple_shove-1.0.2/lib/apple_shove/apple_shove.rb:19:in `feedback_tokens'
        from (irb):4
        from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0.rc1/lib/rails/commands/console.rb:90:in `start'
        from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0.rc1/lib/rails/commands/console.rb:9:in `start'
        from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0.rc1/lib/rails/commands.rb:66:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

I wonder if there's something else that needs to go into the p12 file.

pctj101 commented 11 years ago

FYI Same issue when sending message:

apple_shove: process with pid 28586 started.
Starting daemon with a APNS connection limit of 100
[INFO  2013-05-20 11:26:14] d6eb2ffa559b4c9ca81949e33fe49eca6e9dc2af    created connection to APNS (1 total)
E, [2013-05-20T11:26:14.651389 #28586] ERROR -- : AppleShove::APNS::NotifyConnection crashed!
OpenSSL::X509::CertificateError: nested asn1 error
        /usr/local/lib/ruby/gems/2.0.0/gems/apple_shove-1.0.2/lib/apple_shove/apns/connection.rb:38:in `initialize'
        /usr/local/lib/ruby/gems/2.0.0/gems/apple_shove-1.0.2/lib/apple_shove/apns/connection.rb:38:in `new'
        /usr/local/lib/ruby/gems/2.0.0/gems/apple_shove-1.0.2/lib/apple_shove/apns/connection.rb:38:in `connect'
        /usr/local/lib/ruby/gems/2.0.0/gems/apple_shove-1.0.2/lib/apple_shove/apns/notify_connection.rb:30:in `connect'
        /usr/local/lib/ruby/gems/2.0.0/gems/apple_shove-1.0.2/lib/apple_shove/apns/connection.rb:17:in `socket'
        /usr/local/lib/ruby/gems/2.0.0/gems/apple_shove-1.0.2/lib/apple_shove/apns/notify_connection.rb:43:in `send'
        /usr/local/lib/ruby/gems/2.0.0/gems/celluloid-0.14.0/lib/celluloid/calls.rb:25:in `public_send'
        /usr/local/lib/ruby/gems/2.0.0/gems/celluloid-0.14.0/lib/celluloid/calls.rb:25:in `dispatch'
        /usr/local/lib/ruby/gems/2.0.0/gems/celluloid-0.14.0/lib/celluloid/calls.rb:125:in `dispatch'
        /usr/local/lib/ruby/gems/2.0.0/gems/celluloid-0.14.0/lib/celluloid/actor.rb:328:in `block in handle_message'
        /usr/local/lib/ruby/gems/2.0.0/gems/celluloid-0.14.0/lib/celluloid/actor.rb:422:in `call'
        /usr/local/lib/ruby/gems/2.0.0/gems/celluloid-0.14.0/lib/celluloid/actor.rb:422:in `block in task'
        /usr/local/lib/ruby/gems/2.0.0/gems/celluloid-0.14.0/lib/celluloid/actor.rb:210:in `exclusive'
        /usr/local/lib/ruby/gems/2.0.0/gems/celluloid-0.14.0/lib/celluloid/actor.rb:422:in `task'
        /usr/local/lib/ruby/gems/2.0.0/gems/celluloid-0.14.0/lib/celluloid/actor.rb:319:in `handle_message'
        /usr/local/lib/ruby/gems/2.0.0/gems/celluloid-0.14.0/lib/celluloid/actor.rb:176:in `run'
        /usr/local/lib/ruby/gems/2.0.0/gems/celluloid-0.14.0/lib/celluloid/actor.rb:159:in `block in initialize'
        /usr/local/lib/ruby/gems/2.0.0/gems/celluloid-0.14.0/lib/celluloid/thread_handle.rb:12:in `block in initialize'
        /usr/local/lib/ruby/gems/2.0.0/gems/celluloid-0.14.0/lib/celluloid/internal_pool.rb:59:in `call'
        /usr/local/lib/ruby/gems/2.0.0/gems/celluloid-0.14.0/lib/celluloid/internal_pool.rb:59:in `block in create'
tboyko commented 11 years ago

You're right, it's unclear. I added documentation to README.md specifying that it expects a PEM-formatted PKCS#12 string. You can actually get away with a string that just concatenates the certificate and key strings as well.