Pcornel
Browse topics
Options
Recent
Favorites
Security · Technical reference

Key Pair

Direct answer

A key pair is a mathematically linked public and private key generated together, for example with openssl genpkey or ssh-keygen. What one key does, only the other can undo or verify.

When to use this

Use this when generating and handling key pairs.

First 30 seconds

1. A key pair = private + public key.

2. Generate on the system that uses it (or in HSM).

3. Strong RNG.

4. Document purpose and owner.

5. Rotate periodically.

Context & applicabilityCommon mistakes · platform/version boundaries
Common mistakes
Common mistakes
  • Generating keys on machines with little entropy (fresh VMs, embedded devices) — keys may repeat.
  • Generating server keys on a laptop and copying them around.
  • Using old defaults (ssh-keygen -t rsa 1024 on very old systems).
  • Storing the private key in the same location as the CSR sent to the CA.
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
Key commandopenssl x509 -in server.crt -pubkey -noout | openssl sha256
Scope / prerequisiteUse this when generating and handling key pairs.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

1 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Checking a key pair matches Verify boundary
openssl pkey -in server.key -pubout | openssl sha256
openssl x509 -in server.crt -pubkey -noout | openssl sha256
openssl req  -in server.csr -pubkey -noout | openssl sha256

All three hashes must be identical; otherwise the certificate does not belong to the key.

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
  • Generate keys on the system that will use them.
  • Protect the private key.
  • Back up keys that protect data.
Key checks
  • ssh-keygen -t ed25519 -C <comment> — generate SSH key pair
  • openssl genpkey -algorithm ED25519 -out key.pem — generate
  • Key generation location — on target system/HSM
ReferenceWhy it matters1 section · depth on demand

Generating key pairs

openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:3072 -out rsa.key
openssl genpkey -algorithm ED25519 -out ed.key
openssl pkey -in ed.key -pubout -out ed.pub
ssh-keygen -t ed25519 -C "admin@example.com"

Documented example, not captured output. Generate keys where they will be used (or in an HSM) rather than copying private keys between systems.

ReferenceImportant terms & boundaries1 section · depth on demand

In depth

A key pair is the matching public and private keys generated together for asymmetric cryptography. Generating key pairs correctly — strong algorithm, adequate size, good randomness, generated where the private key will live — is the first step of any certificate, SSH or signing setup.

ssh-keygen -t ed25519 -C "admin@jump01"
openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 -out server.key
openssl req -new -key server.key -subj "/CN=netbox.example.com" -addext "subjectAltName=DNS:netbox.example.com" -out server.csr
UseRecommended algorithm
SSHEd25519
TLS serversECDSA P-256 or RSA 2048/3072
Long-term signingRSA 3072+ or ECDSA P-384

Generate keys on the system that uses them (or in an HSM) and send only the CSR or public key elsewhere.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
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 → Key Pair. 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?