System Design Space
Knowledge graphSettings

Updated: March 24, 2026 at 3:10 PM

Encryption, keys and TLS: how it works in practice

medium

A practical introduction to asymmetric encryption, PKI/certificates, key infrastructure, and how TLS 1.3 works.

Cryptography usually fails not in the math, but in how keys, certificates, and trust points are arranged around it.

The chapter ties asymmetric encryption, PKI, certificates, key lifecycles, and TLS 1.3 into one chain where channel protection depends on the whole key infrastructure rather than on a simple "HTTPS enabled" checkbox.

In interviews, it helps you discuss trust anchors, mTLS, termination points, certificate rotation, and the point where transport security stops and other protection layers begin.

Practical value of this chapter

Design in practice

Use guidance on cryptographic mechanisms, key management, and TLS for channel protection to define architectural security requirements before implementation starts.

Decision quality

Validate solutions through threat model, security invariants, and production control operability, not compliance checklists alone.

Interview articulation

Frame answers as threat -> control -> residual risk, linking business scenario to concrete protection mechanisms.

Trade-off framing

Make trade-offs explicit for cryptographic mechanisms, key management, and TLS for channel protection: UX friction, latency overhead, operational cost, and compliance constraints.

RFC

TLS 1.3 (RFC 8446)

The basic standard for modern TLS handshake and key schedule.

Open RFC

When we talk about channel security and trust between services, there are almost always three layers working behind the scenes: cryptographic primitives, a key infrastructure, and a transport protocol. In practice it looks like a bunch asymmetry + PKI + TLS, and not as one “magic” algorithm.

What is important to understand about encryption

Asymmetric Encryption

  • Key pair: public key can be distributed, private key must remain secret.
  • Encryption is usually done hybridly: the data is encrypted with a symmetric key, and the key is encrypted using a public key.
  • Main practical role: secure key exchange and bootstrap trust.

Digital Signatures

  • The signature confirms the integrity and source of the data (authenticity + integrity).
  • Sign: private key, Verify: public key.
  • In TLS, signatures are used to prove ownership of the server key.

Key Management

  • Real security depends on the lifecycle of keys: generation, storage, rotation, revocation.
  • KMS/HSM, key versioning, access policies and audit trail - basic production minimum.
  • Compromising a private key is often more dangerous than a bug in the protocol itself.

PKI

X.509 / RFC 5280

Standard for certificates and basic rules certificate chain validation.

Open RFC

Public/Private Key Infrastructure (PKI)

Root CA

An anchor of trust. Usually offline, with strict access control.

Intermediate CA

Signs server certificates, isolating the risk from the root key.

Leaf Certificate

A certificate for a specific domain/service with a public key and expiration date.

Revocation / Rotation

CRL/OCSP, short TTL certificates and regular key rotation.

Production approach: private keys should be stored in KMS/HSM with minimal access rights, regular rotation and mandatory auditing of key operations.

Certificate and key lifecycle controls

StageMandatory controlsAction on failure
IssuanceAutomated certificate issuance, domain ownership checks, and minimal TTL defaults.Block certificate issuance and open a security ticket for the service owner.
StoragePrivate keys only in KMS/HSM, strict IAM boundaries, no key export by default.Reject deployment and switch service to no-new-session mode.
RotationPlanned cert/key rotation, overlap window for old/new certs, and health checks.Stop rollout and auto-rollback to last known-good certificate version.
RevocationCRL/OCSP, fast emergency revoke, short-lived certificates to limit blast radius.Isolate trust zone, deny compromised identities, trigger incident playbook.
ObservabilityExpiry monitoring, handshake error metrics, and auditable key operation trails.Raise high-priority alert and enable temporary protective traffic policy.

How TLS 1.3 works (simplified)

Steps not started
Handshake messagesECDHE + HKDF key scheduleEncrypted application traffic
ClientServerClientHellocipher suites, key share, randomServerHello + Certificateselected params, cert chain, signatureShared Secret DerivationECDHE -> HKDF -> session keysFinished Messagesverify handshake transcriptEncrypted Application Data

Before the handshake is completed, the parties agree on parameters and keys, after Finished The application works through a secure channel.

Click Start visualizationto walk through the TLS 1.3 handshake step by step.

TLS 1.3 removed outdated mechanisms and accelerated handshake while maintaining security guarantees.

Even perfect TLS doesn't solve business authorization: AuthZ should be a separate layer.

Crypto-layer operational metrics

Certificate auto-rotation coverage

Target: >= 95%

Indicates key-management maturity and reduces manual operational risk.

Emergency key revoke time

Target: < 15 minutes

Critical to reduce exposure window after private-key compromise.

TLS handshake failure rate

Target: < 0.5%

Highlights early PKI/cipher/certificate issues before they become incidents.

Service mTLS coverage

Target: >= 90%

Shows how deeply zero-trust transport identity is implemented across internal traffic.

Rollout roadmap

1

Phase 1 (0-30 days)

Focus: Crypto asset inventory

Outcome: Complete catalog of certs/keys, owners, expirations, and critical dependencies.

2

Phase 2 (30-60 days)

Focus: TLS baseline standardization

Outcome: Unified cipher suites, minimal TLS versions, and centralized certificate policies.

3

Phase 3 (60-90 days)

Focus: Lifecycle automation

Outcome: Auto-issuance, auto-rotation, expiry alerts, and automated revoke workflows.

4

Phase 4 (90+ days)

Focus: Operational resilience

Outcome: Regular key-compromise drills and measurable crypto-layer reliability SLOs.

Common mistakes

  • Assuming 'HTTPS is enabled' automatically covers all risks: TLS closes the channel, but does not replace AuthN/AuthZ.
  • Long-lived certificates and keys without rotation.
  • Ignoring certificate chain and hostname checks.
  • Storing private keys in plain text on hosts without KMS/HSM and access control.
  • Same keys for different environments (dev/stage/prod).
  • Lack of expiry monitoring and emergency key revoke procedures.

Related chapters

Enable tracking in Settings