How to verify that an SSL key, certificate and CSR match

These commands will output a short string of characters.
If the characters match, then they belong together.

openssl x509 -noout -modulus -in mydomain.crt | openssl md5
openssl rsa -noout -modulus -in mydomain.key | openssl md5
openssl req -noout -modulus -in mydomain.csr | openssl md5