Pcornel
Browse topics
Options
Recent
Favorites
Security · Technical reference

Private Key

Direct 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.

When to use this

Use this when protecting or responding to exposure of a private key.

First 30 seconds

1. Private keys must stay secret.

2. Restrict file permissions; encrypt at rest.

3. Prefer HSM/TPM/KMS (non-exportable).

4. Never commit to repositories.

5. Revoke and rotate if exposed.

Operational verification

private key → protected storage → used for sign/decrypt

Context & applicabilityCommon mistakes · platform/version boundaries
Common mistakes
Common mistakes
  • Private keys in Git repositories or container images.
  • World-readable key files (chmod 600 on Linux).
  • Unencrypted keys on laptops; use a passphrase or hardware token.
  • Same key reused on many servers, so one compromise affects all.
  • No plan for revocation and re-issuing if a key leaks.
Platform / version applicability
Cryptography, PKI and secrets
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformCryptography, PKI and secrets
Scope / prerequisiteUse this when protecting or responding to exposure of a private key.
What next?2 suggested next steps
Evidence1
On this pageJump to a specific section
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points
  • Whoever has the private key can impersonate you.
  • Store it encrypted or in an HSM/TPM.
  • Revoke and reissue on exposure.
Key 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
ReferenceWhy it matters1 section · depth on demand

Protecting private keys

  • File permissions 600, owned by the service account.
  • Passphrase-encrypted (SSH, PEM) or in hardware: TPM, HSM, smart card, cloud KMS (non-exportable).
  • Never in Git, tickets, chat or container images; scan repos for leaked keys.
  • Revoke and replace immediately if exposed (certificate revocation, remove from authorized_keys).
ReferenceImportant terms & boundaries1 section · depth on demand

In depth

A private key is the secret half of an asymmetric key pair: it creates signatures and decrypts or derives keys that the public key enables. Whoever holds it can act as its owner, so protecting it is the core of asymmetric security.

StorageProtection level
HSM / cloud KMSKey never leaves hardware
TPM / secure enclave / smart card / FIDO2 keyNon-exportable, device-bound
Encrypted file with passphraseModerate
Plain fileOnly acceptable with strict permissions on servers (0600)
chmod 600 /etc/ssl/private/server.key
ssh-keygen -p -f ~/.ssh/id_ed25519      # add or change passphrase

If a private key is exposed, revoke related certificates, replace the key pair and investigate its use.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
ReferenceConfiguration & state1 section · depth on demand

Commands

chmod 600 ~/.ssh/id_ed25519
ssh-keygen -p -f ~/.ssh/id_ed25519          # add/change passphrase
openssl pkey -in server.key -aes256 -out server-enc.key
ssh-keygen -t ed25519-sk                     # key on a FIDO2 hardware token

Documented example, not captured output.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docCryptography, PKI and secrets current

Authoritative/upstream documentation reviewed for bounded claims in Asymmetric Cryptography → Private Key. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://csrc.nist.gov/pubs/fips/186-5/final · confidence 94%
Confirmation

Confirm action

Continue?