converting ssl cert from PKCS#12 to PEM
$ openssl pkcs12 -in /path/to/my/cert.p12 -out /pathto/my/cert.pem
If you get “X509_check_private_key:key values mismatch” e.g. with stunnel, then try adding -clcerts
$ openssl pkcs12 -clcerts -in /path/to/my/cert.p12 -out /pathto/my/cert.pem