0

I have following files:

  • root.crt
  • intermediate1.crt
  • intermediate2.crt
  • privatekey.pem

I tried to generate a pfx file with openssl

openssl pkcs12 -export -out certificate.pfx -inkey privatekey.pem -in root.crt -certfile intermediate1.crt -certfile intermediate2.crt

Which gives me following error:

No cert in -in file 'root.crt' matches private key
68310000:error:05800074:x509 certificate routines:X509_check_private_key:key values mismatch:crypto\x509\x509_cmp.c:405:

Is there something wrong with my private key?

Klompara
  • 23
  • 5
  • 1
    Does privatekey.pem corresponds to root.crt? Private key specified with -inkey should match the cert specified with -in . – Sujay Kumar Aug 09 '22 at 11:47
  • Does this answer your question? [How to create .pfx file from certificate and private key?](https://stackoverflow.com/questions/6307886/how-to-create-pfx-file-from-certificate-and-private-key) – Sujay Kumar Aug 09 '22 at 11:50
  • @SujayKumar Yes, the private key was not matching with the crt file – Klompara Aug 09 '22 at 13:30

2 Answers2

0

The root.crt was not matching with the private key. After using the correct crt file it worked.

Klompara
  • 23
  • 5
0

Private key specified with '-inkey file' should match the cert specified with '-in file'.

Sujay Kumar
  • 158
  • 6