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

nested asn1 error #79

Closed
ChannyAzar opened this issue May 20, 2014 · 5 comments
Closed

nested asn1 error #79

ChannyAzar opened this issue May 20, 2014 · 5 comments

Comments

@ChannyAzar
Copy link

I'm having a little problem with the grocer gem.
I followed the documentation's instructions, with my cert.pem file, but got:
nested asn1 error

my code:

pusher = Grocer.pusher(certificate: "#{Rails.root}/lib/dev_cert.pem", 
               passphrase:  "XXX",                      
               gateway:     "gateway.sandbox.push.apple.com", 
               retries:     3)

feedback = Grocer.feedback(FEEDBACK_OPTIONS)
notification = Grocer::Notification.new(
                     device_token:    push_id,
                     alert:               message,
                     badge:             3,
                     sound:             "siren.aiff", 
                     expiry:            Time.now + 60*60, 
                     content_available: true        
                     )

feedback.each do |attempt|
puts "Device #{attempt.device_token} failed at #{attempt.timestamp}"
end         
pusher.push(notification)

ruby version - 1.9.3
grocer version - 0.5.0

More details here: http://stackoverflow.com/questions/23760894/ror-nested-asn1-error-while-sending-push-notification-via-grocer-gem

@ChannyAzar ChannyAzar changed the title Neither PUB key nor PRIV key:: nested asn1 error nested asn1 error May 20, 2014
@stevenharman
Copy link
Member

When you exported the cert from Keychain, did you select and export both the certificate and the private key?

Notice the "select both" in the second image:

select both certificate and private key

@ChannyAzar
Copy link
Author

It wasn't me who exported the cert, we already had a cert.pem file. But this file works fine in apn for node.js.

I have at node.js cert.pem and key.pem files. I tried to merge them into one file for the 'grocer' gem, but still got the error.

@stevenharman
Copy link
Member

It sounds like your cert.pem file is corrupt - maybe it's got a slight formatting issue? Could you try to get someone to regenerate the cert.pem, using the SSL Cert from Apple?

@ChannyAzar
Copy link
Author

Yes. We exported a new cert.pem from Apple - with both the certificate and the private key. Now it works fine. Thanks.

But do you have an idea why in node.js it wasn't corrupt and here it made problems?

@stevenharman
Copy link
Member

But do you have an idea why in node.js it wasn't corrupt and here it made problems?

I have some suspicions/speculations, but nothing for sure. One would be that the library used to unpack the cert.pem file in your NodeJS app somehow deals with the corrupted 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

2 participants