I have a Windows web server, and usually I install the ca-authority in "LocalMachine\Root" and the intermediary PFX certificate in "LocalMachine\My", everything works well. Now I wonder, if during the PFX certificate generation I include the ca-bundle, can I avoid to install the ca-authority in "LocalMachine\Root" and just install the PFX with included the bundle-ca in "LocalMachine\My"?
1 Answers
The root CA certificate is normally installed at the opposite end of the TLS connection to the certificates in the PKCS#12 (PFX) file.
If the PKCS#12 file contains a client authentication certificate along with its private key and the certificate of the CA which issued it (and potentially other intermediate CA certificates) the chain is installed in your device and used to authenticate you to a remote server. That server should have the root CA installed in its trust-anchor store, if it trusts that root CA, which it uses to verify the certificates from the PKCS#12 presented by the client.
Very similarly, if the PKCS#12 file contains a server authentication certificate along with its private key and the certificate of the CA which issued it (and potentially other intermediate CA certificates) then chain is installed in your server and used to authenticate it to your device. Your device should have the root CA installed in its trust-anchor store, if you trust that root CA, which it uses to verify the certificates from the PKCS#12 presented by the server.
Saying that, a PKCS#12 is simply a container, so other combinations of certificates and keys are permitted, but the above are the two most common use-cases.
If you install all the certificates within the PKCS#12 it does not mean you trust any root CA certificates within. Who/what you trust isn't bilateral - it's your choice. You need to explicitly make that choice ensure the integrity of the system.
For example, if you install a PKCS#12 on your Firefox browser, so that you can log in to a website, it does not make sense to install any root CAs within the PKCS#12 in Firefox's trust-anchor store automatically. You may not want to trust that root CA for verifying web servers, only for verifying clients. That is, it's not up to Firefox developers to decide which root CAs you trust.
Similarly, if you install the PKCS#12 in a Windows server, it can present those certificates to any clients which connect to it and those clients (if they have the root CA certificate installed in their trust-anchor store) will trust the server. However, that does not automatically mean you want to trust other certificates presented to your server from that root CA, such as client authentication certificates.
The bottom line is - it's up to you to decide what to trust.
- 4,779
-no-CAfile -no-CApath -untrusted..., then it didn't--which makes sense to me. Thanks. – fourpastmidnight Feb 22 '24 at 21:48openssl verify -show_chain -no-CAfile -no-CApath -untrusted <( openssl x509 >/dev/null; cat; } < server.crt ) server.crtand got the following output:DC = com, DC = mydomain, CN = My Certificate Root Authority\n error 19 at 2 depth lookup: self signed certificate in certificate chain\n error server.crt: verification failed. So your assertion is 100% correct, just because the self-signed Root CA cert is in your bundle doesn't mean that you will trust it. You have to put it in your machine's trust store. (cont'd) – fourpastmidnight Feb 26 '24 at 15:42-no-CAfile -no-CApath) but that I trust the root CA certificate in the bundle and want to verify the bundle trust chain:openssl verify -show_chain -no-CAfile -no-CApath -untrusted <({ openssl x509 >/dev/null <({ openssl x509 >/dev/null; cat; } < combined.crt); cat; } < combined.crt ) -trusted <({ openssl x509 >/dev/null; cat; }) < combined.crt) combined.crtThis yieldscombined.crt: OKwith the resulting trust chain. (cont'd) – fourpastmidnight Feb 26 '24 at 17:28