0

I have generated pem and csr files using the below command.

openssl req -newkey rsa:2048 -keyout key.pem -out req.csr

After this, I sent csr file to the authority and got p7b certificate.

Now, I tried to convert p7b file to p12 format with the below commands.

openssl pkcs7 -print_certs -in certificate.p7b -out certificate.cer
openssl pkcs12 -export -out certificate.p12 -inkey key.pem -in certificate.cer

However, it gives the below error.

No certificate matches private key
error in pkcs12

How can I convert p7b file into p12 file format?

Abhishek Parmar
  • 287
  • 2
  • 8
  • 21
  • Do any of these help: [add -nodes](https://stackoverflow.com/a/24477766/11609403), [convert DER to PEM](https://stackoverflow.com/a/43817683/11609403), [cat the CA bundle](https://stackoverflow.com/a/64662371/11609403), [validate key and cert](https://serverfault.com/a/955451)? – leeharvey1 Jun 17 '22 at 13:31

1 Answers1

0

I think you must call privatekey file

openssl pkcs12 -export -inkey privateKey.key -out certificate.p12 -inkey key.pem -in certificate.cer

  • 1
    Please write your answers in a way that is clear and understandable. For code use the ``` ``` mark or the 4 indentations, to style the code and seperate it from the regular text. – Tomas Katz Dec 13 '22 at 12:02