title: Convert PFX to PEM and error "unable to load certificate"
body: <p>I am trying to converted a wildcard SSL certificate to PEM format so I can use it in Amazon's Cloudfront. The only file format I have available is pfx. I tried using the following commands:</p>
  
  <p><strong>Extract the private key from the PFX</strong></p>
  
  <pre><code>openssl pkcs12 -in {site}.pfx  -nocerts -nodes -passin pass:{password} | openssl rsa -out {site}.key
  </code></pre>
  
  <p><strong>Extract the public key from the PFX</strong></p>
  
  <pre><code>openssl pkcs12 –in {site}.pfx -clcerts -nokeys -passin pass:{password} | openssl x509 -out {site}.cer
  </code></pre>
  
  <p><strong>Extract the chain bundle from the PFX</strong></p>
  
  <pre><code>openssl pkcs12 -in {site}.pfx -nodes -nokeys -cacerts -passin pass:{password} | openssl x509 -out bundle.crt
  </code></pre>
  
  <p>The first two commands ran without any problems, however the last one is returning the following:</p>
  
  <pre><code>MAC verified OK
  unable to load certificate
  17856:error:0906D06C:PEM routines:PEM_read_bio:no start line:.\crypto\pem\pem_lib.c:701:Expecting: TRUSTED CERTIFICATE
  </code></pre>
  
  <p>Any help would be greatly appreciated!</p>