How do I verify that a private key matches a certificate?

Check whether equals result of each command.

privatekey

CSR

certificate