Pcornel
Security · Asymmetric Cryptography

Private Key

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

Back to the Topic

Answer

A private key is the secret half of a key pair, used to decrypt and sign. Protect it with file permissions, passphrases, HSMs or TPMs, and revoke the certificate immediately if it is exposed.

Remember

  • Whoever has the private key can impersonate you.
  • Store it encrypted or in an HSM/TPM.
  • Revoke and reissue on exposure.

First checks

  • ls -l <key.pem> — permissions (600)
  • Key stored in HSM/TPM/KMS — non-exportable
  • grep -r 'BEGIN .*PRIVATE KEY' <repo> — leaked keys in code

Verify in this order

private key → protected storage → used for sign/decrypt

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=4702

Confirmation

Confirm action

Continue?