how to bundle key and certificate together into one p12 certificate

You might want to bundle certificate and private key together to be able to sign things and googling takes bit more than expected. Here is rundown at one place

Lets generate key for certificate by running following

openssl genrsa -out mysite.key 2048

Lets obtain signing request with this new key just generated

openssl req -new -sha256 -key mysite.key -out mysite.csr

Now to be able to have it in p12 format we should convert certificate we got from signing authority to PEM

openssl x509 -inform DER -in mysite.crt -out mysite.pem -outform PEM

Now to tie key and certificate together into one certificate that one can use to sign things

openssl pkcs12 -export -clcerts -inkey mysite.key -in mysite.pem -out mysite.p12 -name “My Site”

enjoy :-)

computer user

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store