How to verify that SSL certificate matches key

In order to verify that OpenSSL key matches certificate you can run following command: For key: openssl rsa -noout -modulus -in yourdomain.key | openssl md5 and for certificate: openssl x509 -noout -modulus -in yourdomain.crt | openssl md5 and for CSR (Certificate Signing Request): openssl req -noout -modulus -in yourdomain.csr <span style="box-sizing: border-box; color: #2aa198;">| openssl md5</span> In all cases you should get the same output, for example: (stdin)=d41d8cd98f00b204e9800998ecf8427e If the output is the same in all cases this means that keys match certificate.