title: Getting OpenSSL::X509::CertificateError nested asn1 error on Ruby
body: <p>I have .p12 file from Apple and tried to convert it to .pem file with following command:</p>
  
  <pre><code>openssl pkcs12 -in cert.p12 -out apple_push_notification_development.pem -nodes -clcerts
  </code></pre>
  
  <p>When trying the create new OpenSSL::X509::Certificate object with</p>
  
  <pre><code>OpenSSL::X509::Certificate.new(File.read('apple_push_notification_development.pem'))
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>OpenSSL::X509::CertificateError: nested asn1 error
      from (irb):9:in `initialize'
      from (irb):9:in `new'
      ...
  </code></pre>
  
  <p>Did I do something wrong ? Being stuck, please help.
  Thanks</p>