A.8 Converting a Signed Certificate into PKCS12 Format

If you have the private key in Base64 format, use the following command to generate PKCS8 private key:

openssl pkcs8 -inform PEM -nocrypt -in base64_private_key_file -out output_filename

Example:

openssl pkcs8 -inform PEM -nocrypt -in /home/b64_private.key -out /home/pkcs8_private.key

If you have the private key in PKCS8 format and a certificate file, use the following command to generate a PKCS12 certificate file:

openssl pkcs12 -export -out pkcs12_outfile -inkey pkcs8_private_key file_path -in certificate_file_path

Example:

openssl pkcs12 -export -out pkcs12.cert -inkey /home/pkcs8_private.key -in /home/mycert.cer