среда, 16 сентября 2015 г.

Apple Certificates to PEM

p12 => pem
openssl pkcs12 -in Certificates.p12 -out push.prod.crt.pem -nodes -clcerts

bin crt => pem
openssl x509 -inform der -in aps_production.cer -outform pem -out certificate.pem


While trying to update a certificate on a produciton enviroment I ran into the following issue, Apache only accepts certificates in PEM format, since my client provided me with his new certificate on a .cer file I had to find a way to convert it.
For x509 certificates this can be easily achieved using OpenSSL on Linux/Unix and OS X. First make sure you have OpenSSL (comes by default with OS X), open a terminal and issue the following command:
openssl x509 -inform pem -in certificate.cer -outform der -out certificate.pem
Where certificate.cer is the source certificate file you want to convert and certificate.pem is the name of the converted certificate.

The inform and outform options are reversed. The command should be:
openssl x509 -inform der -in certificate.cer -outform pem -out certificate.pem

https://github.com/richsage/RMSPushNotificationsBundle/issues/60#issuecomment-40174938
http://perrohunter.com/how-to-convert-a-cer-certificate-to-pem-on-linuxunix-and-os-x/#comment-4398