Recently I have raised a request for the creation of SSL certificate creation for one of the domains attached with an application. I have received a file with the extension p12. There was no separate private key file in the bundle. So I had to split the PKCS file into the certificate and the private key.
The command to perform the conversion is given below. The first command generates the certificate from the PKCS file and the second command generates the private key.
openssl pkcs12 -in file.p12 -out newfile.crt.pem -clcerts -nokeys openssl pkcs12 -in file.p12 -out newfile.key.pem -nocerts -nodes