How to check that a TLS certificate matches its private key
Before reloading, extract the public key from both the certificate and the private key, compare their SHA-256 hashes, and handle read errors separately. Tested with OpenSSL 3.0.13: a matching pair, a different pair, and a damaged file.















