title: Apple Push Notifications, how do I properly export my cert?
body: <p>I can't seem to figure out how to properly export my cert for use in my iOS app with push notifications. I'm using the following cert, downloaded from the <strong>Certificates</strong> section of the <strong>iOS Provisioning Portal</strong>.</p>
  <p><img src="https://i.stack.imgur.com/F0Z8s.png" alt="enter image description here" /></p>
  <p>I'm then following one of the many tutorials I've found all over the web that are all different by the way, to get my cert into a <strong>.pem</strong> format for use in <strong><a href="http://code.google.com/p/ruby-apns-daemon/" rel="noreferrer">ruby-apns</a></strong>.</p>
  <p>First I export it from the Keychain:</p>
  <p><img src="https://i.stack.imgur.com/z6GvN.png" alt="enter image description here" /></p>
  <p>After I give it a name and a password I perform the following commands in the terminal*:</p>
  <pre><code>openssl pkcs12 -in cert.p12 -out apple_push_notification_dev.pem -nodes -clcerts
  </code></pre>
  <p><em>*note: this isn't the only way I've tried this, just the latest, I have also tried via the instructions at the following urls:</em></p>
  <ul>
  <li><a href="http://blog.boxedice.com/2010/06/05/how-to-renew-your-apple-push-notification-push-ssl-certificate/" rel="noreferrer">http://blog.boxedice.com/2010/06/05/how-to-renew-your-apple-push-notification-push-ssl-certificate/</a></li>
  <li><a href="http://blog.boxedice.com/2009/07/10/how-to-build-an-apple-push-notification-provider-server-tutorial/" rel="noreferrer">http://blog.boxedice.com/2009/07/10/how-to-build-an-apple-push-notification-provider-server-tutorial/</a></li>
  <li><a href="http://code.google.com/p/apns-sharp/wiki/HowToCreatePKCS12Certificate" rel="noreferrer">http://code.google.com/p/apns-sharp/wiki/HowToCreatePKCS12Certificate</a></li>
  <li><a href="http://wiki.cs.unh.edu/wiki/index.php/Using_the_Apple_Push_Notification_Service" rel="noreferrer">http://wiki.cs.unh.edu/wiki/index.php/Using_the_Apple_Push_Notification_Service</a></li>
  </ul>
  <p>Not a single one of these solutions work. I'm sitting here looking at the following error from the console when I try to use ruby-apns:</p>
  <pre><code>read finished A: sslv3 alert certificate unknown (OpenSSL::SSL::SSLError)
  </code></pre>
  <p>And essentially every other server solution I've found has told me my certificate is incorrect or that there's a problem with it as well.</p>
  <p>Am I doing this wrong?</p>
  <p>===============================</p>
  <h2>Overnight Courtesy Bump Stealth Edit</h2>
  <p>So I beat my head against the wall last night, and actually came across Apple's own instructions for doing this. It's almost the exact same, and I tried it to the same tune. Nevertheless, here is the latest attempt from <a href="http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ProvisioningDevelopment/ProvisioningDevelopment.html#//apple_ref/doc/uid/TP40008194-CH104-SW1" rel="noreferrer">this link</a>:</p>
  <pre><code>openssl pkcs12 -in CertificateName.p12 -out CertificateName.pem -nodes
  </code></pre>