openssl: No certificate matches private key / chained certificate

10,808

I just had such a problem and it turned out that the "chainedcertificate.pem" file must have root, intermediate, key certificate in this exact order. Then it worked.

Share:
10,808
user643605
Author by

user643605

Updated on June 04, 2022

Comments

  • user643605
    user643605 almost 2 years

    I am getting this error while binding a chained certificate with a private key:

    "No certificate matches private key"

    the command I use is the following:

    openssl pkcs12 -export -in chainedcertificate.pem -inkey private.pem -name MyCert -out chained.p12

    Inside my chainedcertificate.pem is three blocks of BEGIN/END CERTIFICATE. CA, Intermediate and user certificate are in the file in reverse order (i.e. CA being last).

    When I remove the the two last blocks and leave only the user certifcate, the chained.p12 is generated without any error.

    Why would the insertion of the root certificate and intermediate would compromise the creation with this kind of error message ???