Tuesday 14 March 2017

Converting pk7 to pem encoded certificate / key pair to PKCS12 format

Often if a key pair is pem encoded and you wish to transport this securely for use on a Windows server you will need to convert the pem encoded files to the PKCS12 format - which is effectively an encrypted container for the key pair.

We can perform the conversion for this with openssl - by firstly converting the p7b file (which is simply a container with in most cases the main certificate plus any other certificates in the chain):

openssl pkcs7 -print_certs -in certifcates.p7b -out certifcates.cer

and then from PEM to pkcs12 format:

openssl pkcs12 -export -inkey certifcate.key -in certifcates.cer -out certificates.p12

0 comments:

Post a Comment