skip to content
Alvin Lucillo

Verify key, crt, and csr match

/ 1 min read

Let’s say you created a self-signed certificate

openssl genrsa -out client.key 2048
openssl req -new -key client.key -out client.csr -subj "/CN=client"
openssl x509 -req -in client.csr -signkey client.key -out client.crt -days 365

You can verify those files match by checking their md5 values. See that they all have the same output.

openssl rsa -noout -modulus -in client.key | openssl md5
MD5(stdin)= c060cc7f4ded0a1957b6b3e63ecb9ffd

openssl req -noout -modulus -in client.csr | openssl md5
MD5(stdin)= c060cc7f4ded0a1957b6b3e63ecb9ffd

openssl x509 -noout -modulus -in client.crt | openssl md5
MD5(stdin)= c060cc7f4ded0a1957b6b3e63ecb9ffd