title: OpenSSL::PKey::RSAError (Neither PUB key nor PRIV key: nested asn1 error) while using Grocer gem on RoR app
body: <p>I know there are a lot of questions on this scenario but I've tried every solution and I am still stuck. I am using the grocer gem to send push notifications to the APN service. I am stuck on the certificate issue.</p>
  
  <p>Here's the code</p>
  
  <pre><code>pusher = Grocer.pusher(
    certificate: "#{Rails.root}/public/certificate1.pem",      # required
    passphrase:  "",                       # optional
    gateway:     "gateway.push.apple.com", # optional; See note below.
    port:        2195,                     # optional
    retries:     3                         # optional
  ) 
  
  
  notification = Grocer::Notification.new(
    device_token: token,
    alert: "#{uname} liked your post",
    sound: 'default',
    badge:  0
  )
  
  pusher.push(notification)
  </code></pre>
  
  <p>I am in a production environment where I am hosting the app on Heroku. Heroku logs show me this </p>
  
  <pre><code>OpenSSL::PKey::RSAError (Neither PUB key nor PRIV key: nested asn1 error):
  app/controllers/api/v1/feeds_controller.rb:49:in `likeit'
  </code></pre>
  
  <p>Line 49 is the line where the notification is pushed.</p>
  
  <p>I'm certain that the certificate I'm using is proper as I have tested push notifications using it. Also when generating the pem file I have exported both the certificate as well as the private key. </p>
  
  <p>Reference: <a href="https://github.com/grocer/grocer" rel="nofollow">grocer gem</a></p>
  
  <p>Any suggestions are welcome!</p>