Convert .p7b key to a .pfx or .p12 with openssl

https://serverfault.com/questions/83143/convert-p7b-key-to-a-pfx

openssl pkcs7 -print_certs -in certificate.p7b -out certificate.cer
openssl pkcs12 -export -in certificate.cer -inkey privateKey.key -out certificate.pfx -certfile CACert.cer
openssl pkcs12 -export -in certificate.cer -inkey certificate.key -out certificate.p12