Pcornel
Security · Asymmetric Cryptography

Asymmetric Cryptography Troubleshooting

Cheat sheet · https://pcornel.dk/topic.php?topic=4705

Back to the Topic

Answer

Troubleshoot asymmetric crypto by checking key type and size match, the private key is present and readable, certificate and key pair correspond (compare moduli), the correct padding or curve is used, and that clocks are right for certificates.

Remember

  • Key and certificate must match.
  • Padding and curve must match on both sides.
  • Certificates need correct time.

First checks

  • openssl pkey -in key.pem -noout -text — key readable/correct type
  • openssl x509 -noout -modulus -in cert.pem | sha256sum; openssl rsa -noout -modulus -in key.pem | sha256sum — cert/key match (RSA)
  • Format conversions (PEM/DER/PKCS#12) — encoding

Commands

openssl pkey -pubin -in <public-key.pem> -text -noout
Read-only/validation observation for public-key algorithm, size/parameters and parsability without exposing private-key…
openssl pkey -pubin ... -text -noout

Verify in this order

key + cert + format → tool → operation

Where it usually breaks

First mismatch in key/secret generation → storage/rotation → trust/certificate validation → protocol negotiation → cryptographic operation → peer/application verification; preserve identity/policy/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=4705

Confirmation

Confirm action

Continue?