Skip to content

Identify mismatching public certificates and private keys

Allan Roger Reid edited this page Oct 28, 2024 · 1 revision
openssl pkey -in private.crt -pubout -outform pem  
-----BEGIN PUBLIC KEY-----
...
-----END PUBLIC KEY-----
 openssl x509 -in public.crt -pubkey -noout -outform pem
-----BEGIN PUBLIC KEY-----
...
-----END PUBLIC KEY-----
mismatch
echo "LS0...==" | base64 -d | openssl x509 -noout -pubkey | openssl ec -pubin -outform der | openssl dgst -sha256
read EC key
writing EC key
SHA2-256(stdin)= 1234
echo "LS0...==" | base64 -d | openssl ec -pubout -outform der | openssl dgst -sha256
read EC key
writing EC key
SHA2-256(stdin)= 5678
mismatch
Clone this wiki locally