title: openssl: how to convert pfx into pem in a script
body: <p>I can successfully convert a pfx into a pem if I run <code>openssl pkcs12 -in cert.pfx -out cert.pem -password pass:mypass</code>. I will be prompted though to enter the PEM passphrase so the private key is encrypted inside the .pem file.</p>
  
  <p>But in a script, how do I automatically enter the PEM passphrase? I tried using -passin argument but it had no effect.</p>
  
  <p>I´m guessing that if I concatenate the PEM cert and the PEM key individually (not from the pfx) it would be equivalent to converting from pfx to pem, but the PEM file that comes from the PFX has those Bag Attributes outside the the base64 string and I don´t know if that matters or not.</p>
  
  <p>So, how do I properly "create" a PEM file, with encrypted private key, without being prompted form passphrases?</p>