Pcornel
Security · Secrets Management

Private Keys

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

Back to the Topic

Answer

Private keys used for TLS, SSH and signing are secrets of the highest value. Store them encrypted with restrictive permissions, ideally in an HSM, TPM or vault, and rotate them on exposure.

Remember

  • Encrypted at rest with tight permissions.
  • HSM or TPM for high value keys.
  • Revoke and replace on exposure.

First checks

  • find / -name '*.pem' -o -name '*.key' 2>/dev/null | xargs ls -l — key file permissions
  • HSM/KMS usage — non-exportable keys
  • gitleaks detect — keys in repos

Verify in this order

key → protected storage → use

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

Confirmation

Confirm action

Continue?