Threat Models and Kerckhoffs's Principle

Imagine a company designs a secret, in-house encryption algorithm. It keeps its inner workings classified. A disgruntled engineer leaves and takes the source code. Now every message the company ever encrypted looks like it might be readable by someone. This scenario has repeated across history, from military codes to DVD encryption. It motivates one of the oldest and most load-bearing ideas in cryptography. Security cannot depend on hiding the method. It must depend only on a small, replaceable, easily protected secret called the key. This article formalizes two intertwined ideas that every cryptographic system relies on. First, a threat model — a precise statement of what an adversary can see, do, and compute. This matters because "secure" is meaningless without specifying against whom. Second, Kerckhoffs's Principle, the design rule that a cryptosystem must remain secure. It must stay secure even when everything about it, except the key, is public knowledge. Together these ideas turn "is this cipher secure?" from a vague hope into a testable, falsifiable question. The stakes are not academic. Every widely deployed cryptographic standard — AES, RSA, TLS, Signal's protocol — is published in full detail. Source code, specifications, design rationale: all of it is public. Attackers, including state-level ones, are assumed to have this documentation. That these systems remain secure anyway is not an accident. It is the entire point of designing them this way. Systems that instead relied on secret algorithms have a consistent historical record. This includes proprietary cellular ciphers and certain DRM schemes. Once reverse-engineered, they collapsed. Their security was never really mathematical. It was just obscurity wearing a costume. This article builds the vocabulary to reason about adversaries rigorously. It covers what capabilities a threat model must specify. It explains the classical ladder of attacker access, from ciphertext-only up through chosen-ciphertext. It shows why "security through obscurity" fails as an engineering strategy. Finally, it explains how Kerckhoffs's Principle sets up the modern framing. In this framing, a cryptosystem is a public algorithm plus a secret key. This paves the way for formal computational security definitions.

Key takeaways
  • A threat model precisely specifies adversary goals, knowledge, access, and computational power — without one, "secure" is undefined.
  • Kerckhoffs's Principle (1883): a cryptosystem must stay secure even if everything but the key is public.
  • Shannon reformulated this as "the enemy knows the system" — the modern default assumption in all cryptographic design.
  • Classical attacker models form a ladder: ciphertext-only, known-plaintext, chosen-plaintext, chosen-ciphertext, each strictly stronger.
  • Security through obscurity fails because secrets that are hard to change (algorithms) get exposed, while secrets that are easy to change (keys) can be rotated.
  • Modern standards (AES, RSA, TLS) are fully public specifications; their security rests entirely on key secrecy and computational hardness.
The core insight

Security must depend only on a secret, easily changeable key — never on the secrecy of the algorithm itself, because algorithms leak and keys can be rotated.

The idea

A threat model is a formal specification of an adversary: what the adversary already knows, what access it has to the system (which messages, oracles, or side channels it can query), what it is trying to achieve (recover a key, forge a signature, distinguish two ciphertexts), and how much computational power it has (unbounded, polynomial-time, a specific time-space budget). Without fixing these four dimensions — knowledge, access, goal, power — a claim like "this cipher is secure" has no content. Security is always security against a specific adversary, and different threat models can yield opposite verdicts about the same scheme.

Kerckhoffs's Principle, stated by Auguste Kerckhoffs in 1883, is a design constraint that follows from taking threat models seriously: a cryptosystem should remain secure even if everything about the system — the algorithm, its implementation, its design rationale — is known to the adversary, except the secret key. Claude Shannon later restated this crisply as the maxim "the enemy knows the system." This does not mean designers should publish their keys or want the algorithm to leak; it means the system must be engineered so that leakage of the algorithm causes no damage, because all functional secrecy is concentrated in a small, independently generated, easily replaced key. The principle rests on an economic and operational argument about which secrets are cheap to protect. An algorithm is baked into hardware, shipped in software binaries, documented for interoperability, and used by millions of parties — it is structurally hard to keep secret and essentially impossible to change quickly if compromised. A key, by contrast, is a short string generated on demand, stored in one place, and trivially rotated if exposed. A design that puts its security burden on the hard-to-protect secret (the algorithm) rather than the easy-to-protect secret (the key) is fragile by construction. This is why "security through obscurity" — relying on the adversary's ignorance of design details — is not merely frowned upon but formally rejected: it substitutes an assumption that cannot be verified or safely relied upon for one that can be precisely modeled and mathematically analyzed. Related foundational goals like Goals of Cryptography: Confidentiality, Integrity, Authenticity only become meaningful once a threat model pins down exactly what "protecting" those goals means.

How it works

Reasoning about threat models is not a single algorithm in the way sorting is, but it is a disciplined procedure: a checklist applied uniformly to any cryptosystem before any security claim is trusted. The "mechanism" here is the standard classification of adversary access levels — the ladder cryptographers climb to stress-test a scheme — plus the logical test that Kerckhoffs's Principle imposes on any proposed design.

Step 1 — Fix the four dimensions of the threat model. Specify adversary knowledge (does it know the algorithm? prior ciphertexts? plaintext structure?), access (what can it query, and how many times?), goal (recover the key? read one message? forge one signature? merely distinguish two possibilities?), and computational power (unbounded, or polynomial-time in a security parameter).

Step 2 — Classify the attack model by access level. The classical hierarchy, from weakest to strongest attacker access:

  • Ciphertext-only attack (COA): adversary sees only ciphertexts.
  • Known-plaintext attack (KPA): adversary has some (plaintext, ciphertext) pairs, not chosen by it.
  • Chosen-plaintext attack (CPA): adversary can submit chosen plaintexts and see their ciphertexts (models an "encryption oracle").
  • Chosen-ciphertext attack (CCA): adversary can additionally submit chosen ciphertexts and see their decryptions (models a "decryption oracle"), often split into CCA1 (queries before seeing the challenge) and CCA2 (queries even after, excluding the challenge itself).

Each level strictly subsumes the previous one: any scheme secure against CCA is automatically secure against CPA, KPA, and COA, because a CCA adversary can simply decline to use its decryption oracle and simulate a weaker attacker. This gives a partial order of attacker strength, not just an arbitrary list.

Step 3 — Apply Kerckhoffs's test. Given a proposed cryptosystem, ask: if the adversary in the chosen threat model is handed the complete specification of the algorithm — source code, hardware schematics, design documents — does security still hold, assuming only the key remains secret? If the answer is "no, the scheme relies on the adversary not knowing how it works," the design is rejected regardless of how clever it looks, because that assumption cannot be operationally guaranteed and cannot be re-established once broken.

Step 4 — Formalize "break" as a game. Modern treatments (foreshadowing Computational Security and the Adversary Model) turn this into an explicit interactive game between a challenger and an adversary algorithm, with a probability of adversary success bounded as a function of a security parameter. The pseudocode below captures the generic structure of such a game — this is the template that CPA-security, CCA-security, and similar definitions all instantiate. ``` // Generic security game template (instantiated for a given attack model) // Public: the full algorithm description Enc, Dec (Kerckhoffs's Principle: // these are given to the adversary, unlike the key) Game IND-ATK(scheme, adversary, security_parameter n): key <- KeyGen(n) // secret, unknown to adversary (m0, m1, state) <- adversary.Phase1(Enc, Dec_oracle_if_ATK_allows_it) require |m0| == |m1| b <- uniform_random_bit() c <- Enc(key, m_b) // the "challenge" ciphertext b_guess <- adversary.Phase2(c, state, Enc, Dec_oracle_if_ATK_allows_it) return (b_guess == b) // adversary "wins" if true // ATK in {COA, KPA, CPA, CCA1, CCA2} controls which oracles Phase1/Phase2 // may query and whether the decryption oracle is available before/after c. // The adversary's advantage is: // Adv(adversary) = | Pr[wins] - 1/2 | // A scheme is "ATK-secure" if Adv(adversary) is negligible in n // for every adversary bounded to the power allowed by ATK. ``` The comment lines are not incidental — they are* Kerckhoffs's Principle written into the game: `Enc` and `Dec` are given to the adversary as public procedures, and the only thing hidden is `key`, generated fresh by `KeyGen`. Any security proof about this game is automatically a proof that holds even though the adversary fully understands the algorithm.

Figure
Adversary access levels and where Kerckhoffs's Principle applies
Threat Model: What the Adversary Knows vs. What Stays Secret Public (known to adversary, per Kerckhoffs's Principle): Algorithm specification · Enc/Dec procedures · Hardware design · Protocol messages · Ciphertext(s) in transit Only exception → SECRET KEY Adversary Access Ladder (each level ⊇ powers of the one below): COA sees ciphertext only KPA given (m, c) pairs CPA chooses plaintexts, gets c CCA also chooses c, gets m increasing adversary power → Kerckhoffs's Test Give the adversary (at whichever ladder level you are testing) the full public box above. If the scheme's security still holds — with only the red key hidden — the design PASSES. If security relies on the adversary not knowing the algorithm, the design FAILS: that assumption ("secrecy of design") cannot be operationally guaranteed or safely renewed.

Complexity & correctness

There is no runtime "complexity" for a definitional framework in the way there is for a sorting algorithm, but the right analogous claims are (a) how attacker classes relate as a partial order, and (b) why Kerckhoffs's Principle is a logically forced consequence of taking threat models seriously, not a stylistic preference.

Claim 1: the attack-model ladder is a genuine partial order of strength. If a scheme resists a CCA2 adversary, it automatically resists CPA, KPA, and COA adversaries. Argument. Security "against ATK-adversaries" means: for every probabilistic polynomial-time adversary restricted to the oracles/queries allowed under ATK, the winning advantage in the security game is negligible. A CPA adversary is a CCA2 adversary that simply never invokes the decryption oracle — its strategy space is a strict subset of the CCA2 adversary's strategy space. If no CCA2-restricted adversary (a superset of strategies) can win non-negligibly, then in particular no adversary confined to the smaller CPA strategy space can win non-negligibly either. Formally, if ACPA⊆ACCA2\mathcal{A}_{\text{CPA}} \subseteq \mathcal{A}_{\text{CCA2}} as sets of admissible adversary strategies, then

max⁡A∈ACCA2Adv(A)≥max⁡A∈ACPAAdv(A),\max_{A \in \mathcal{A}_{\text{CCA2}}} \mathrm{Adv}(A) \ge \max_{A \in \mathcal{A}_{\text{CPA}}} \mathrm{Adv}(A),

so a negligible bound on the left forces a negligible bound on the right. This is why textbooks always present CCA-security as "strictly stronger" — it is a mathematical containment, not a rhetorical ranking.

Claim 2: Kerckhoffs's Principle is forced by the requirement that threat models be honest. A threat model that assumes "the adversary does not know the algorithm" is not a stable assumption: algorithms are shipped in binaries (reverse-engineerable), standardized for interoperability (must be published to be adopted), and implemented by many parties (any one of whom can leak it), so in essentially every real deployment this assumption fails to hold for the lifetime of the system. Since a security claim is only as strong as its threat model's fidelity to reality, a claim resting on "the algorithm stays secret" is a claim about a threat model that does not match deployment conditions — the proof, even if mathematically valid, is a proof about the wrong adversary. Kerckhoffs's Principle removes this brittle assumption by requiring the strongest realistic assumption — full algorithm disclosure — up front, so that whatever security is proved, it is proved against the adversary that will actually exist.

Corollary — the key/algorithm asymmetry. Suppose (for contradiction) that a scheme's security genuinely depends on hiding the algorithm EE rather than a key kk. Once EE leaks (which the above argument shows is highly likely over the system's lifetime), there is no independent secret left to rotate: regenerating "a new algorithm" is exactly as hard as designing and validating the entire cryptosystem from scratch, including a fresh security analysis. Contrast this with a key-based scheme: if kk leaks, the system runs `KeyGen` again, at negligible cost, and continues using the same publicly-analyzed, already-trusted algorithm EE. This is the precise sense in which putting secrecy in the key rather than the algorithm is a strictly better engineering decision, not merely a philosophical one — recoverability from compromise differs by orders of magnitude between the two designs.

Honest tradeoffs. Kerckhoffs's Principle does not claim that hiding the algorithm is worthless as a defense-in-depth layer — an unpublished proprietary tweak can raise short-term cost for an opportunistic attacker. What it rejects is relying on that secrecy as the security argument, since it is unverifiable by outside experts (no public cryptanalysis, hence no confidence it resists KPA/CPA/CCA-strength attackers), non-renewable once broken, and often a symptom of a design that was never analyzed rigorously in the first place. Published, heavily scrutinized algorithms (AES, RSA, ChaCha20) benefit from decades of adversarial cryptanalysis by the global research community — a form of stress-testing that a secret algorithm can never receive.

Worked example

Consider two competing designs for encrypting the same set of messages, evaluated against an escalating threat model, to see exactly where each one breaks.

Design A — "SecretShuffle": a proprietary substitution cipher whose substitution table is a company trade secret, embedded directly in shipped firmware, never published.

Design B — "AES-CTR with a random key": a fully public, standardized algorithm (AES in counter mode); only the 128-bit key is secret and freshly generated per deployment.

Threat model stepDesign A (secret algorithm)Design B (secret key, public algorithm)
1. Ciphertext-only, adversary does not have firmwareLooks secure: adversary sees only ciphertext, cannot even attempt frequency analysis without knowing the substitution structure.Secure: AES-CTR ciphertext is computationally indistinguishable from random without the key.
2. Firmware is extracted (reverse-engineered from a purchased device)Breaks immediately. The "secret" substitution table is now public; the cipher is a plain substitution cipher, breakable by frequency analysis in seconds (foreshadowing Classical Ciphers and Substitution). Every message ever encrypted with that firmware version is now retroactively readable.Unaffected. The AES algorithm was always assumed public; extracting firmware reveals no key material, since the key was never stored in a way that firmware analysis exposes it (assuming proper key management).
3. Vendor response to compromiseMust design, implement, validate, and re-deploy an entirely new secret algorithm to every device in the field — a slow, expensive, and error-prone process, and the new algorithm is unvalidated by any outside cryptanalyst.Simply runs `KeyGen()` again and redistributes a new key; the algorithm (AES) needs no change and remains backed by 20+ years of public cryptanalysis.
4. Chosen-plaintext attack (adversary can request encryptions of chosen messages)Trivial: with firmware known, an adversary can directly read off the substitution table from a handful of chosen plaintext/ciphertext pairs — full break.Standard CPA-security proof for AES-CTR under the pseudorandom-permutation assumption for AES still applies; advantage remains negligible.
Kerckhoffs's test verdictFAILS. Security depended on firmware secrecy, an assumption that did not survive contact with a single extracted device.PASSES. Security was never assumed to depend on the algorithm's secrecy; only the key does the work, and the key is independently protected and rotatable.

The lesson is not "Design A used a weak cipher by bad luck." Design A's entire security argument was structurally unsound: it rested on an assumption (firmware secrecy) that a threat model honestly accounting for reverse-engineering capability would never grant. Design B's argument rests on an assumption (key secrecy, backed by a hardness assumption about AES) that is independently verifiable, has survived decades of public attack, and can be re-established cheaply after a compromise. The difference is exactly Kerckhoffs's Principle in action.

Common pitfalls & traps

PitfallWhy it happensConsequence
Treating "secure" as an absolute propertySkipping the step of naming the threat model explicitlyClaims become unfalsifiable; a scheme can be "secure" against one adversary and trivially broken against a slightly stronger one
Confusing obscurity as a layer with obscurity as the mechanismConflating defense-in-depth (fine) with the sole security argument (not fine)False confidence; once the obscure detail leaks, there is no fallback security guarantee
Assuming CPA-security implies CCA-securityNot checking the strict containment direction of the ladderDeploying a CPA-secure scheme where an adversary can query a decryption oracle (e.g., padding-oracle scenarios) leads to real breaks
Ignoring implementation/side-channel access when defining "knowledge"Threat model only covers ciphertext, forgets timing, power, cache accessFormally "secure" cipher still broken via side-channel key recovery in practice
Believing published algorithms are secure because publishedOvercorrecting Kerckhoffs's Principle into "publication implies security"Publication only enables scrutiny; the algorithm must still survive cryptanalysis (many published ciphers have been broken)

Pioneers & history

Origins · 1 minAuguste Kerckhoffs and how this was discovered
AK
Auguste Kerckhoffs
1835–1903 · Dutch linguist and cryptographer working in France during the era of telegraph cryptography

Kerckhoffs published La Cryptographie Militaire in 1883, laying out six design desiderata for military ciphers. The second of these — that the system must not require secrecy and must be able to fall into enemy hands without inconvenience — is the principle that now bears his name. Writing in an age when telegraph operators, couriers, and captured equipment routinely exposed cipher devices to adversaries, Kerckhoffs argued from hard operational experience: any security argument resting on the enemy's ignorance of your method was a security argument destined to fail the moment a single device or operator was compromised.

History
1883
— Auguste Kerckhoffs publishes La Cryptographie Militaire, stating the principle that only the key need remain secret.
1949
— Claude Shannon's Communication Theory of Secrecy Systems formalizes "the enemy knows the system" and grounds cryptography in information theory.
1976
— Diffie and Hellman publish New Directions in Cryptography, assuming fully public algorithms and formalizing adversary-facing security definitions.
2001
— NIST selects Rijndael as AES after an open, multi-year public competition, embodying Kerckhoffs's Principle at national-standard scale.
2013
–present — Widespread post-Snowden scrutiny reinforces open cryptographic review as the default expectation for any deployed standard.

Where this matters

Every modern cryptographic standard is designed and vetted under Kerckhoffs's Principle: AES, RSA, elliptic-curve schemes, SHA-family hash functions, and the TLS protocol are all fully public specifications, openly documented in RFCs and standards documents, implemented in open-source libraries (OpenSSL, BoringSSL, libsodium), and subjected to years of public cryptanalysis before and after adoption. NIST's open competitions for AES and for post-quantum algorithms exist specifically to harness worldwide adversarial review, an approach only coherent because the underlying design philosophy assumes the algorithm will be public. Threat modeling in the sense formalized here underlies security engineering broadly, not just cipher design: TLS's threat model explicitly assumes a network adversary who can read, inject, and modify all traffic (Dolev–Yao style); hardware security modules and smart cards are designed assuming an adversary with physical access and side-channel measurement capability; and messaging protocols like Signal are designed assuming server compromise, device seizure, and even key compromise at some point in time (motivating forward secrecy). In every case, the discipline is the same one introduced here: name the adversary's knowledge, access, goal, and power precisely, then design so that only a small, rotatable secret — never the public machinery — carries the security burden. This foundational discipline is precisely what later frameworks formalize as Computational Security and the Adversary Model, where "negligible advantage" and polynomial-time adversaries turn these qualitative arguments into provable theorems.

Ask the tutor: How does the formal notion of "negligible advantage" in a security game turn Kerckhoffs's informal principle into a provable mathematical guarantee?

What exactly counts as a "threat model" in cryptography?

A threat model is a precise specification of four things about an adversary: what it already knows (e.g., the algorithm, some plaintexts), what access it has (which oracles or queries it can make, and how many), what its goal is (full key recovery versus merely distinguishing two ciphertexts), and how much computational power it has (unbounded, or bounded to polynomial time). Security claims are always relative to a fixed threat model; a scheme can be provably secure against one model (say, ciphertext-only attackers) while being completely broken under a stronger one (chosen-ciphertext attackers). Specifying the threat model turns "is this secure?" from an opinion into a testable mathematical claim.

Does Kerckhoffs's Principle mean you should publish your actual secret keys?

No — it means the opposite in the sense that matters. The principle says the algorithm, protocol, and implementation details should be assumed public and the design should remain secure anyway; the key is the one component that must stay secret and is generated, stored, and rotated specifically to carry that burden. Publishing a key would defeat the system entirely, since the key is precisely the quantity the whole design is built to protect. The principle is about where you concentrate secrecy, not about eliminating secrecy altogether.

Is "security through obscurity" always completely worthless?

Not entirely worthless as a supplementary layer, but it is rejected as a primary security mechanism. Hiding an implementation detail can raise the cost for an opportunistic, low-effort attacker temporarily, which is why some systems use it as one layer among several (defense in depth). The failure mode is relying on obscurity as the argument for security: it cannot be independently verified by outside experts, provides no formal guarantee, degrades to zero the moment it leaks, and offers no way to "rotate" the secret the way a key can be regenerated. Serious cryptographic design treats it as a bonus, never a foundation.

What is the difference between a chosen-plaintext attack and a chosen-ciphertext attack?

In a chosen-plaintext attack (CPA), the adversary can submit any plaintexts it likes and observe their corresponding ciphertexts, modeling access to an "encryption oracle." In a chosen-ciphertext attack (CCA), the adversary additionally gets access to a "decryption oracle" — it can submit chosen ciphertexts (other than the actual challenge) and see the resulting plaintexts. CCA is strictly stronger because any CPA adversary can be simulated by a CCA adversary that simply never calls the decryption oracle; CCA-security is required for schemes exposed to active network attackers who can inject and observe responses to malformed messages, such as in many real-world protocol settings.

Why do modern standards like AES go through public competitions instead of being designed in secret by one organization?

Public competitions harness the entire global cryptographic research community as an adversarial testing pool, which is far more thorough than any single team's internal review. When NIST ran the AES selection process, dozens of independent research groups spent years attempting to break each candidate; the eventual winner (Rijndael) survived all of that public scrutiny. This process is only meaningful because of Kerckhoffs's Principle: an algorithm is expected to be fully disclosed and analyzed, and its trustworthiness comes from surviving open attack, not from remaining unseen. A secretly designed algorithm never receives this validation and so cannot earn the same level of assurance.

How does this connect to what comes after basic threat modeling, like computational security definitions?

Threat modeling gives the qualitative vocabulary — knowledge, access, goal, power — while computational security definitions make these notions quantitative and provable. Instead of informally saying "the adversary can query chosen plaintexts," a computational security definition sets up an explicit game (as sketched in the pseudocode above), bounds the adversary to probabilistic polynomial-time algorithms, and requires that its advantage in winning be a negligible function of a security parameter. This is precisely the machinery developed in the study of Computational Security and the Adversary Model, where informal threat-model reasoning becomes formal, provable security.

Can a scheme be secure against one threat model but insecure against another, even without any bug?

Yes, and this is expected, not a contradiction. A block cipher used naively (ECB mode) can be perfectly secure against a ciphertext-only attacker in the sense that individual blocks look random, yet catastrophically insecure against pattern-recognition because identical plaintext blocks produce identical ciphertext blocks, leaking structural information visible even to a COA-level adversary. Similarly, a scheme proven CPA-secure can fail badly against a CCA adversary if a decryption oracle is available (as in classic padding-oracle attacks). The scheme has not changed — only the threat model has — which is exactly why threat models must be stated explicitly before any security claim is meaningful.

Before this

Where this leads