Of the four threats in this module, this is the only one that has not happened yet and, at the same time, the only one that forces you to take decisions today. Artificial intelligence is already inside Rutalia, blockchains already underpin ransom payments, and the A006 probes are already vulnerable. The quantum computer capable of breaking the cryptography that protects the internet does not exist yet, and probably will not for one or two decades. Even so, there is data that Rutalia must start protecting against that machine right now, and the reason is subtler and more uncomfortable than it seems.
In June 2028, during INC-2028-014, 11.42 GB of data left Rutalia. It was written off as lost, the AEPD (the Spanish Data Protection Agency) was notified and the company moved on. But that data, if it was encrypted with the usual algorithms, is not entirely lost: it is waiting. An attacker who stored it could decrypt it on the day a capable machine exists, ten or fifteen years from now. And among those 11.42 GB were employment records, contracts and accident reports containing health data, whose confidentiality must last for decades. That mismatch —between how long the secret lasts and how long the threat takes to arrive— is the heart of this lesson.
This is also the lesson that closes Module 7 and takes the course back to where it started: the cryptography of Module 2. You are not going to relearn what AES, RSA or Diffie-Hellman are; you are going to see which of them survive the quantum computer, which do not, and what is done about the ones that do not. And you will do so with the same technical honesty that has guided the whole module: distinguishing what is established —the algorithms already standardised— from what is experimental, and stating clearly what depends on the pace of research, which nobody knows for certain.
Important notice. This content is for training purposes. Timescales for the arrival of a cryptographically relevant quantum computer are estimates with great uncertainty, not dates: anyone who gives you an exact date is selling something. The post-quantum algorithms cited are standardised, but their deployment is under way and their details are evolving; always check against the current publications of the standards body and of your national authority. The qubit figures in the headlines are systematically misinterpreted, and this lesson explains why. All the companies, people, incidents and amounts at Rutalia are fictitious.
- What a quantum computer really is
A quantum computer is a machine that processes information by exploiting phenomena of quantum mechanics that an ordinary computer does not use. Four concepts, precisely and without misleading metaphors:
- Qubit (quantum bit). The unit of information. A classical bit is 0 or 1. A qubit, as long as it is not measured, is described by a combination of both states, with an amplitude associated with each. Beware of the myth: it is not that it is "0 and 1 at the same time" in the sense of storing two values; it is a state described by complex numbers, and measuring it yields a single 0 or a single 1, with a probability that depends on those amplitudes. All the "superposed" information collapses into a classical result the moment it is read.
- Superposition. The ability of a system of qubits to be in that combination of states before measurement. With n qubits, the state is described by 2ⁿ amplitudes. This sounds like massive parallelism, but it is not, at least not directly: you cannot read the 2ⁿ possibilities, only one when you measure.
- Entanglement. Two or more qubits can become correlated in such a way that the state of the whole cannot be described as that of each one separately. It is a genuinely quantum resource, with no classical equivalent, and it is what gives certain algorithms their power.
- Decoherence. The enemy. Quantum states are extraordinarily fragile: any interaction with the environment —a vibration, a photon, heat— destroys them. Keeping qubits stable requires extreme isolation and temperatures close to absolute zero, and even so they last fractions of a second. That is why building these machines is so difficult.
The consequence of decoherence is the most important distinction in the whole lesson, and we come back to it in section 6: the difference between physical qubits (the real ones, noisy, which break down) and logical qubits (stable units built by combining many physical ones with error correction). You need many physical qubits for one reliable logical qubit, and that ratio is what separates the headlines from reality.
- Why it is NOT "a faster computer"
The central misunderstanding that needs stamping out: a quantum computer is not a sped-up classical computer. It will not run your spreadsheet faster, it will not serve web pages more quickly, it will not train AI models in an instant. For the vast majority of computing tasks, it is worse than a laptop.
What a quantum computer does is offer an advantage —sometimes an enormous one— on a very specific set of problems with a particular mathematical structure that certain quantum algorithms know how to exploit. The list of those problems is short and, by an unfortunate historical coincidence, two of them are exactly the problems on which today's asymmetric cryptography rests.
| Classical computer | Quantum computer | |
|---|---|---|
| General tasks (office work, web, databases) | Excellent | Useless or worse |
| Unstructured search | Linear | Quadratic advantage (Grover) |
| Integer factorisation and discrete logarithm | Exponential (infeasible at large sizes) | Exponential advantage (Shor): makes it feasible |
| Simulating quantum systems (chemistry, materials) | Very costly | Its most promising application, and it is not cryptography |
Look at the last row: the most valuable and likely use of these machines is simulating molecules and materials for chemistry and pharmaceuticals. Breaking cryptography is a side effect, not their reason for being. But it is the side effect that you have to manage.
- What it breaks: Shor's algorithm
In 1994, Peter Shor described a quantum algorithm that factorises large integers efficiently, and that equally solves the discrete logarithm problem. Those two problems are, respectively, the foundation of:
- RSA, whose security rests on the fact that factorising the product of two large primes is infeasible for a classical computer.
- Diffie-Hellman and elliptic curve cryptography (ECC), which rest on the difficulty of the discrete logarithm.
A classical computer would take longer than the age of the universe to factorise a 2048-bit RSA key. A sufficiently large and stable quantum computer running Shor would do it in hours or days. The security is not degraded: it disappears.
And this does not affect "RSA and ECC" as something abstract and distant. Go back over Modules 2 and 3 in your head, and you will see that it affects almost all the security you have deployed during the course:
flowchart TD
S["Shor's algorithm<br/>(large quantum computer)"] --> RSA["RSA"]
S --> ECC["ECC / ECDSA"]
S --> DH["Diffie-Hellman"]
RSA --> T1["TLS 1.3: key exchange<br/>for MiRutalia and the website"]
ECC --> T1
DH --> T1
ECC --> T2["SSH: Diego's access to the servers"]
RSA --> T3["Digital signatures and PKI:<br/>the internal CA, the certificates,<br/>code and document signing"]
ECC --> T3
RSA --> T4["Remote access VPN"]
ECC --> T4
RSA --> T5["Email signing, eIDAS,<br/>timestamps"]
style S fill:#f8d7da,stroke:#842029
style T1 fill:#fff3cd,stroke:#997404
style T3 fill:#fff3cd,stroke:#997404
Everything in the course that uses public keys to agree a key, authenticate or sign is in Shor's line of fire. In other words: the TLS 1.3 handshake from 03-02, SSH access, the VPN from 03-04, the PKI and signatures from 02-05, mTLS with customers, and the certificates for the new probes under the specification in 07-03.
- What it barely affects: Grover's algorithm
The other side, and it is good news that needs to be properly understood so as not to exaggerate the threat. In 1996, Lov Grover described a quantum algorithm that speeds up unstructured search: finding a needle in a haystack of N items. A classical computer needs of the order of N attempts; Grover does it in the order of √N.
Applied to breaking a symmetric key by brute force or to inverting a hash, Grover halves the effective security, measured in bits. It does not eliminate it: it reduces it. And that has a very reassuring practical consequence:
- An AES-128 key offers 128 bits of classical security. Against Grover, it would be left with about 64 effective bits, which is already uncomfortable. The solution: AES-256, which against Grover keeps about 128 effective bits, comfortably secure.
- A SHA-256 hash keeps about 128 bits against Grover for preimage resistance. For maximum headroom, SHA-384 or SHA-512.
The rule of thumb, easy to remember: against the quantum threat, symmetric cryptography and hashes only need to double their size. AES-256 and SHA-384 remain secure. Nothing new has to be invented for them: you just have to use the large sizes that already exist.
And there is a nuance that many texts exaggerate: Grover's advantage is hard to parallelise and requires a gigantic number of sequential, coherent quantum operations, which makes it far less practical than the formula suggests. In real terms, the threat to symmetric cryptography is much less pressing than the threat to asymmetric cryptography. The urgent problem is Shor, not Grover.
- The table you need: algorithm → affected? → replacement
This is the table that sums up the threat and that you should be able to reconstruct from memory. It is the map for everything that follows.
| Current algorithm (from the course) | Type | Affected? | Threat | Severity | Replacement or mitigation |
|---|---|---|---|---|---|
| RSA (encryption and signing) | Asymmetric | Yes, broken | Shor | CRITICAL | ML-KEM (exchange), ML-DSA / SLH-DSA (signing) |
| ECC / ECDSA / ECDH | Asymmetric | Yes, broken | Shor | CRITICAL | ML-KEM, ML-DSA |
| Diffie-Hellman (classic and elliptic) | Key agreement | Yes, broken | Shor | CRITICAL | ML-KEM, in hybrid mode |
| AES-128 | Symmetric | Weakened | Grover | Medium | AES-256 |
| AES-256 | Symmetric | Practically not | Grover | Low | None: it is already sufficient |
| SHA-256 | Hash | Slightly | Grover | Low | SHA-384 / SHA-512 for headroom |
| SHA-384 / SHA-512 | Hash | Practically not | Grover | Low | None |
| HMAC (with a strong hash) | Authentication | No | — | — | None |
Reading it at a glance: everything asymmetric (public key) is in critical danger and has to be replaced; everything symmetric, and hashes, only needs to use large sizes, which you already have available. The boundary is exactly the one that separated, in Module 2, public-key cryptography from secret-key cryptography.
- The real state of the technology and the headline figures
This is where technical honesty matters most, because it is where there is most noise.
Every so often a headline appears: "New machine with X qubits". The instinctive reaction is alarm. The correct reaction is to ask what kind of qubits.
Remember the distinction from section 1:
- Physical qubit: the real one, noisy, which breaks down through decoherence in fractions of a second. It is the one the headlines count.
- Logical qubit: a stable, reliable unit, built by combining many physical qubits with quantum error correction, so that the whole survives the failures of its components.
The ratio between the two is devastating for easy alarm: depending on the quality of the physical qubits, you need of the order of hundreds or thousands of physical qubits for each reliable logical qubit.
And now the orders of magnitude. Breaking a 2048-bit RSA key with Shor requires, according to published estimates, of the order of thousands of logical qubits operating coherently for hours. Translated into physical qubits with current error correction, that is of the order of millions of high-quality physical qubits.
| Typical headline | What is needed to break RSA-2048 | |
|---|---|---|
| Physical qubits | Hundreds or a thousand or so | Of the order of millions |
| Logical qubits | Often zero stable ones | Thousands |
| Coherence | Fractions of a second | Hours of reliable operation |
| Error correction | Early demonstrations | Mature and at scale |
The distance between what exists today and what would be needed is therefore several orders of magnitude, not an incremental adjustment. That is why the scientific community talks of timescales of the order of 10 to 20 years, with enormous uncertainty in both directions: it could speed up with an unforeseen breakthrough in error correction, or stall for decades if the physical obstacles turn out to be harder than expected. Nobody knows, and be wary of anyone who claims to know precisely.
- Why uncertainty is no excuse for doing nothing
It is tempting to conclude: "if it's 10 or 20 years away and not even certain, I'll worry about it later". That is a mistake, and the rest of the lesson explains why. There are three reasons, in order of strength:
- The harvest now, decrypt later argument (section 8), which makes the threat to the confidentiality of long-lived data current, not future.
- Cryptographic migration is slow: changing all the algorithms, certificates, protocols and dependencies of an organisation takes years, not a weekend. If you start when the machine arrives, you are too late.
- Uncertainty works against you, not for you: planning for the optimistic scenario ("it's 20 years away") when the pessimistic one is possible ("a breakthrough brings it forward to 8") is exactly the risk management mistake this course teaches you not to make.
The conclusion is not "run", it is "start putting your house in order". And the first piece of that order is understanding the argument that makes it urgent.
- "Harvest now, decrypt later" applied to Rutalia
The argument —harvest now, decrypt later— is simple and devastating:
An attacker can capture and store today encrypted traffic and data they cannot decrypt, and decrypt them years later, when they have a quantum computer. The confidentiality of that data is not lost on the day the machine exists: it is lost on the day it is captured, if its secrecy must last until then.
This turns a future threat into a present decision for any data whose confidentiality has to survive beyond the quantum computer's horizon. Applied to Rutalia:
- The 11.42 GB from INC-2028-014. If the attacker keeps that volume —and keeping it costs nothing—, everything that was encrypted with RSA/ECC in transit, or protected by keys derived from them, can be decrypted in the future. Among that data were employment records and accident reports containing health data.
- Interceptable traffic. An attacker able to capture traffic at some point on the network —a compromised supplier, an intermediate point— may be storing the establishment of MiRutalia's TLS sessions today, and waiting.
- Long-term backups. The
resticbackups kept for years are encrypted; if the protection of their keys depends on vulnerable asymmetric cryptography, their future confidentiality is in question.
Notice the nuance that makes this argument manageable rather than paralysing: not all data matters equally. Data whose confidentiality only matters for an hour —a session checking on a shipment that has already been delivered— runs no risk at all from harvest now, decrypt later, because by the time the machine exists the data will be irrelevant. The risk applies exclusively to data with a long confidentiality life. And separating that data out is precisely what the formula in the next section does.
- Mosca's formula, worked out for several assets
Michele Mosca proposed a decision rule that turns everything above into arithmetic. It is based on three periods of time:
- X = the lifetime of the secret. How many years must this data remain confidential?
- Y = the migration time. How many years will it take me to migrate this system to quantum-resistant cryptography?
- Z = the time until the quantum computer. How many years are left before a machine capable of breaking current cryptography exists?
The rule:
If X + Y > Z, you have a problem. That is: if the time the data must remain secret plus the time it will take you to protect it exceeds the time left before the threat arrives, there will be a window in which your data is exposed. And since Y (migrating) and Z (the threat) are fixed for the whole organisation, the larger X is, the sooner you have to start.
flowchart LR
subgraph Hoy["Now (2029)"]
A["I start migrating"]
end
A -->|"Y = migration"| B["System protected"]
A -->|"Z = quantum arrives"| C["Threat active"]
B -.->|"X = lifetime of the secret"| D["The data no longer matters"]
style C fill:#f8d7da,stroke:#842029
style B fill:#d1e7dd,stroke:#0f5132
Let us apply it to Rutalia with prudent values: assume Y = 3 years (migrating an SME, without haste but without pause) and a conservative Z of 10 years (the reasonable pessimistic scenario, which is the one to use in risk management). The alarm threshold is then X > Z − Y = 10 − 3 = 7 years: any data whose confidentiality must last more than 7 years has a problem if work does not start now.
| Asset / data | X (lifetime of the secret) | X + Y > Z? (Y=3, Z=10) |
Urgent? |
|---|---|---|---|
| Employment records (long legal retention) | ~30-50 years | 33-53 > 10 | YES, top priority |
| Accident reports with health data | Decades | >> 10 | YES, top priority |
| Contracts with customers and suppliers | 10-15 years | 13-18 > 10 | YES |
| Customer portfolio and commercial terms | 10+ years | > 10 | YES |
| Long-term backups | Depends on what they contain | Inherits the maximum | YES |
| HR data and historical payroll | Many years | > 10 | YES |
| Temperature telemetry (cold chain) | ~2-5 years (warranty/claims) | 5-8 < 10 | Not urgent |
| Shipment enquiry sessions on MiRutalia | Hours | << 10 | No |
| The day's fuel prices | Days | << 10 | No |
The table teaches two management lessons, not cryptographic ones. First: urgency is set by the data, not by the system. The same TLS connection is urgent if it carries an employment record and trivial if it carries a shipment enquiry. Second: the work of this lesson starts by classifying data, not by changing algorithms —which, incidentally, you already know how to do, because it is the information classification of 02-01 with a new axis: the confidentiality horizon.
- What post-quantum cryptography is
It is worth clearing up a very common confusion here. There are two completely different approaches to defending against the quantum computer, and only one of them is relevant to an ordinary company:
| Post-quantum cryptography (PQC) | Quantum key distribution (QKD) | |
|---|---|---|
| What it is | New algorithms, running on ordinary computers, based on mathematical problems that even a quantum computer cannot solve | A hardware method that uses quantum physics to exchange keys |
| Where it runs | On your server, your laptop, your probe: software | It requires dedicated optical fibre or special links and extremely expensive equipment |
| Who it is for | Everyone: it is the general solution | Very specialised cases; not for an SME (section 14) |
| Maturity for deployment | Standardised and being deployed | Limited, expensive and with practical problems |
Post-quantum cryptography is what matters to you. These are public-key algorithms —for agreeing keys and for signing— designed to resist both classical and quantum computers, and they work on the hardware you already have. They replace RSA and ECC by doing the same job, but relying on different mathematical problems, which neither Shor nor any known quantum algorithm can solve efficiently.
It is important to underline what does not change: symmetric cryptography (AES) and hashes (SHA) do not need post-quantum replacements, only large sizes (section 4). PQC only replaces the asymmetric part. The secret-key foundations from Module 2 remain standing.
- The mathematical families and the NIST standardisation process
PQC does not rest on a single problem, but on several independent mathematical families. That there are several and that they are independent is not a detail: it is a deliberate risk management strategy, because if one family is broken one day, the others remain standing. At a conceptual level, without going into the mathematics:
| Family | Intuitive idea | Used for |
|---|---|---|
| Lattices | Finding the point of a multidimensional grid closest to another point is fiendishly difficult in many dimensions | Key exchange and signing. It is the basis of the main algorithms |
| Error-correcting codes | Decoding a message with deliberately introduced errors, without the key, is infeasible | Key exchange; studied extensively since the 1970s |
| Hash functions | Building signatures using only hashes, whose security you already know from Module 2 | Signing. Very conservative: its security depends only on the hash |
| Isogenies | Relationships between elliptic curves | Promised small keys; one of its proposals was broken (section 13) |
The NIST standardisation process —NIST being the US standards institute— is the worldwide reference and deserves to be understood, because it explains why you can trust the result. It was not a committee choosing behind closed doors: it was a public, open competition, started in 2016, in which cryptographers from all over the world submitted candidates and, above all, spent years trying to break everyone else's. The ones that survived that scrutiny are the ones that were standardised. That adversarial, transparent process is exactly what provides assurance, and it is also what brought SIKE down.
In 2024 the first final standards were published, with their official names, and that is where we need to bring things down to earth.
- The standardised algorithms, compared
Three algorithms, with their competition name and their official standard name, which are worth knowing because both names are used in practice:
| Standard | Competition name | Function | Family | Key characteristic |
|---|---|---|---|---|
| ML-KEM | Kyber | Key encapsulation (agreeing a secret key) | Lattices | Fast, moderate keys and messages. The general replacement for Diffie-Hellman |
| ML-DSA | Dilithium | Digital signature | Lattices | Fast, well balanced. The general-purpose signature |
| SLH-DSA | SPHINCS+ | Digital signature | Hash | Large signatures and slower, but maximum confidence: its security depends only on the hash |
"KEM" stands for key encapsulation mechanism: instead of the Diffie-Hellman exchange you saw in 02-04, one party generates a secret key, "encapsulates" it with the other party's public key and sends it; the other party "decapsulates" it with its private key. The result is the same —both share a secret key— by a different mathematical route.
Now the part that has practical engineering consequences, which you need to know so as not to be caught out when deploying:
| Property | RSA-2048 / ECC | ML-KEM | ML-DSA | SLH-DSA |
|---|---|---|---|---|
| Public key size | Small (ECC very small) | Larger (of the order of KB) | Larger | Small |
| Signature / message size | Small | Moderate | Larger | Very large |
| Speed | Well known | Very fast | Fast | Slow |
| Maturity / confidence | Decades (but breakable) | High, recent | High, recent | Very high (hashes only) |
The engineering conclusion: post-quantum algorithms tend to have larger keys and signatures than ECC. That is not a problem for a web server, but it does matter on resource-constrained devices —the IoT probes from 07-03— and in protocols where the size of the handshake counts. It is one of the reasons why the migration is an engineering project and not a simple configuration change: there are places where a signature several times larger forces a redesign.
- The lesson in humility of the SIKE case, and hybrid modes
In 2022, one of the competition's advanced candidates, SIKE —from the isogeny family, admired precisely for its small keys—, was completely broken. Not by a quantum computer: by mathematicians with an ordinary laptop, using classical mathematics, in a matter of hours. A candidate that had survived years of scrutiny fell at a stroke.
The lesson of SIKE is one of humility, and it is the most important one in this part:
These algorithms are new. They have years of analysis behind them, not decades like RSA. Being standardised means they have withstood the best scrutiny available so far, not that they are immune to a future attack nobody has discovered yet. Confidence is high, but it is not the forty years of confidence we had in RSA.
From that humility comes the engineering decision that dominates current deployment: hybrid modes.
A hybrid mode combines a classical algorithm and a post-quantum one at the same time: for example, one key exchange is performed with ECDH (classical) and another with ML-KEM (post-quantum), and the final session key is derived from both. The reasoning is elegant and defensive:
- If the post-quantum algorithm turned out to have an unknown flaw (the SIKE scenario), the classical one still protects you against today's classical attacker.
- If the quantum computer arrives and breaks the classical one, the post-quantum one still protects you.
- Only an attacker who broke both at once would succeed, which is enormously harder.
flowchart LR
A["Classical exchange<br/>ECDH"] --> C["Combined derivation<br/>of the session key"]
B["Post-quantum exchange<br/>ML-KEM"] --> C
C --> D["Session key secure<br/>if at least ONE holds"]
style D fill:#d1e7dd,stroke:#0f5132
It is, at heart, defence in depth applied to cryptography: the same philosophy as in Module 1, not putting all your security in a single mechanism. And it is already happening: the main browsers and web servers already negotiate hybrid key exchanges in TLS, and there is support for hybrid exchange in SSH implementations. When Diego updates the corporate browser or the SSH client, it is quite possible that he is already using post-quantum cryptography without having configured it. That is the most realistic deployment route for an SME: inheriting it from updated tools, not implementing it by hand.
- Quantum key distribution (QKD) and why it is not for an SME
A brief and honest note, because the term comes up and causes confusion. QKD uses physical properties of quantum particles —typically photons over optical fibre— to exchange a key in such a way that any attempt at interception physically alters the transmission and is detected. It sounds like the perfect solution. It is not, for almost anyone, for compelling practical reasons:
- It requires specialised and very expensive hardware and, often, dedicated optical fibre with distance limits.
- It only solves key exchange, not authentication, which still needs conventional cryptography (and so it does not remove the need for PQC).
- It is vulnerable to attacks on the physical implementation of the equipment itself.
- The leading cybersecurity authorities recommend PQC over QKD for practically every case, precisely because it is software that can be deployed without special infrastructure.
For Rutalia, QKD is a technological curiosity with no practical application whatsoever. The solution is PQC, in software, inherited from the tools and required in contracts.
- What Rutalia should do today: the six actions
This is the practical heart of the lesson. None of these six actions requires buying a quantum computer, hiring a physicist or spending much money at all. They require starting to put the house in order, which is the only sensible response to a threat that is distant but involves a slow migration.
- Cryptographic inventory. Knowing which algorithms, keys, certificates and protocols Rutalia uses and where. You cannot migrate what you do not know about, exactly like the device inventory in 07-03. It reuses the certificate inventory and
vigilar_certificados.pyfrom 02-05. It is action number one, and section 16. - Require crypto-agility in contracts and in development: the ability to change the algorithm without rebuilding the system. It links with 06-04 and 08-01. Section 17.
- Upgrade the cheap things now. No waiting for PQC to do what can be done today: AES-256 instead of AES-128, SHA-384, TLS 1.3, and generous key sizes. It reduces exposure to Grover and raises the general bar at no cost.
- Classify data by confidentiality horizon. The Mosca table from section 9: identifying which data must remain secret beyond the quantum horizon. It is the classification from 02-01 with a time axis. Without this step, you do not know what to protect first.
- Keep an eye on suppliers and plan the PKI migration. Asking suppliers about their PQC plans (just as they are asked about end of support under the CRA), and mapping out how the internal CA, the certificates and mTLS will be migrated when the time comes.
- Do not buy hot air. Rejecting products that promise "quantum security" without substance. Section 19.
- The cryptographic inventory, in code
Action number one, made executable. The aim is not sophistication: it is to have a list of what cryptography there is, where, and how urgent its migration is according to Mosca.
#!/usr/bin/env python3
"""
inventario_cripto.py - Cryptographic inventory to prepare for the
post-quantum migration. It goes through certificates, SSH keys and
TLS configuration, and classifies each finding by migration urgency.
It reuses the list of domains from vigilar_certificados.py (02-05).
"""
import subprocess, ssl, socket, json, sys
# Classification of algorithms according to their quantum resistance.
# It is the core of the tool: it turns an algorithm into a verdict.
VERDICT = {
# Asymmetric: broken by Shor -> migrate
"rsaEncryption": ("ASYMMETRIC", "VULNERABLE_SHOR", "HIGH"),
"id-ecPublicKey": ("ASYMMETRIC", "VULNERABLE_SHOR", "HIGH"),
"dsaEncryption": ("ASYMMETRIC", "VULNERABLE_SHOR", "HIGH"),
# Symmetric and hash: Grover only -> a large size is enough
"aes-256": ("SYMMETRIC", "QUANTUM_OK", "NONE"),
"aes-128": ("SYMMETRIC", "WEAK_GROVER", "MEDIUM"),
"sha256": ("HASH", "ACCEPTABLE", "LOW"),
"sha1": ("HASH", "ALREADY_OBSOLETE", "IMMEDIATE"),
# Post-quantum: the target
"ML-KEM": ("PQC", "RESISTANT", "NONE"),
"ML-DSA": ("PQC", "RESISTANT", "NONE"),
}
def classify(algorithm: str) -> tuple:
for key, verdict in VERDICT.items():
if key.lower() in algorithm.lower():
return verdict
return ("UNKNOWN", "MANUAL_REVIEW", "REVIEW")
def urgency_by_data(secret_life_years: int, Y=3, Z=10) -> str:
"""Applies Mosca's rule: X + Y > Z indicates exposure."""
if secret_life_years + Y > Z:
return "URGENT (X+Y>Z)"
return "can wait"
def inspect_tls(host: str, port: int = 443) -> dict:
"""Extracts the public key algorithm from the server's certificate."""
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE # inventory only, no validation
with socket.create_connection((host, port), timeout=5) as sock:
with ctx.wrap_socket(sock, server_hostname=host) as tls:
cert_der = tls.getpeercert(binary_form=True)
version = tls.version()
# openssl to read the certificate's public key algorithm
output = subprocess.run(
["openssl", "x509", "-inform", "DER", "-noout", "-text"],
input=cert_der, capture_output=True).stdout.decode(errors="ignore")
algorithm = "unknown"
for line in output.splitlines():
if "Public Key Algorithm" in line:
algorithm = line.split(":")[-1].strip()
if "Public-Key" in line: # key size
algorithm += " " + line.split(":")[-1].strip()
kind, status, priority = classify(algorithm)
return {"host": host, "tls": version, "algorithm": algorithm,
"type": kind, "status": status, "technical_priority": priority}
def inspect_ssh_keys(paths: list) -> list:
"""Classifies SSH keys by type. ed25519 and ecdsa: Shor. rsa: Shor."""
findings = []
for path in paths:
output = subprocess.run(["ssh-keygen", "-l", "-f", path],
capture_output=True).stdout.decode()
# Format: "<bits> SHA256:... comment (TYPE)"
key_type = output.strip().split("(")[-1].rstrip(")") if output else "?"
# ALL current SSH keys (RSA, ECDSA, Ed25519) are
# asymmetric and vulnerable to Shor: this is something to inventory,
# not to panic about, because today there is no widespread SSH replacement.
findings.append({"key": path, "type": key_type,
"status": "VULNERABLE_SHOR (no SSH replacement yet)"})
return findings
if __name__ == "__main__":
with open(sys.argv[1]) as f: # domains file (02-05)
domains = [l.strip() for l in f if l.strip()]
inventory = []
for d in domains:
try:
inventory.append(inspect_tls(d))
except Exception as e:
inventory.append({"host": d, "error": str(e)})
print(json.dumps(inventory, indent=2, ensure_ascii=False))
# Summary by priority: how many assets need migrating, and when.
vulnerable = [x for x in inventory if x.get("status") == "VULNERABLE_SHOR"]
print(f"\n{len(vulnerable)} of {len(inventory)} certificates use "
f"cryptography vulnerable to Shor.", file=sys.stderr)Example output:
[
{"host": "mirutalia.rutalia.example", "tls": "TLSv1.3",
"algorithm": "id-ecPublicKey (256 bit)", "type": "ASYMMETRIC",
"status": "VULNERABLE_SHOR", "technical_priority": "HIGH"},
{"host": "www.rutalia.example", "tls": "TLSv1.3",
"algorithm": "rsaEncryption (2048 bit)", "type": "ASYMMETRIC",
"status": "VULNERABLE_SHOR", "technical_priority": "HIGH"}
]The value of this inventory is not to cause alarm —it is to be expected that today everything uses RSA and ECC, because that is what exists—, but to have the list for the day migration has to happen, cross-referenced with Mosca's data classification so as to know where to start. Just like the IoT device inventory: you cannot manage what you have not listed.
- Crypto-agility: requiring it in contracts and in development
Crypto-agility is the property of a system that allows the cryptographic algorithm to be changed without rebuilding the system. It is the most valuable design lesson in the whole lesson, because it is the only thing that makes the future migration cheap rather than traumatic.
The anti-pattern, which Marta Ruiz recognised in MiRutalia's old code:
# BAD - the algorithm is "hard-wired" throughout the code. Migrating means
# hunting down and changing dozens of places, with the risk of missing one.
def sign(data):
return rsa_sign(data, rsa_2048_key) # RSA embedded here
def verify(data, signature):
return rsa_verify(data, signature, rsa_public_key) # and hereThe agile pattern:
# GOOD - the algorithm is a CENTRALISED and CONFIGURABLE decision.
# The day the move to ML-DSA has to happen, ONE place is changed and tested,
# and optionally both are supported at the same time during the transition.
class SignatureProvider:
def __init__(self, config):
self.algorithm = config["signature_algorithm"] # "rsa2048" today...
# ..."ml-dsa" tomorrow
def sign(self, data):
return ALGORITHM_REGISTRY[self.algorithm].sign(data)
def verify(self, data, signature, declared_algorithm):
# Verifies with the algorithm it was signed with: this allows
# old and new signatures to coexist during the migration.
return ALGORITHM_REGISTRY[declared_algorithm].verify(data, signature)And in contracts —building on the due diligence from 06-04— crypto-agility becomes a clause:
Crypto-agility clause (technical annex) The Supplier declares that its product/service allows the replacement of the cryptographic algorithms (encryption, key exchange and signing) without redesigning the architecture, and undertakes to incorporate standardised quantum-resistant algorithms within a reasonable period after they become available, at no additional cost within the support period. It shall provide, upon request, an inventory of the cryptographic algorithms used by the product.
This clause is, for Rutalia today, more important than any particular algorithm, because it shifts the obligation to be prepared onto the supplier. It is the same mechanism as the CRA end of support for the probes: I do not solve the technical problem; I guarantee by contract that whoever has to solve it will do so.
- The phased roadmap (2029-2035)
Taken to CSI-2029-04 as part of the multi-year plan. Notice that it is deliberately slow and cheap at the start: almost all the early effort goes into inventorying, classifying and requiring, not migrating.
| Phase | Period | Actions | Cost | Owner |
|---|---|---|---|---|
| 1 · Know | 2029-2030 | Full cryptographic inventory; classification of data by horizon (Mosca); team training | Low: in-house hours | L. Méndez / D. Salas |
| 2 · Put in order | 2030-2031 | AES-256 and SHA-384 in everything new; TLS 1.3 mandatory; crypto-agility clause in all new contracts; refactoring MiRutalia towards an agile design | Low-medium | M. Ruiz / D. Salas |
| 3 · Adopt what is inherited | 2031-2033 | Enable hybrid modes in TLS and SSH as the updated tools offer them; prioritise systems that handle long-X data | Medium | D. Salas |
| 4 · Migrate our own | 2033-2035 | Migrate the internal PKI and mTLS to post-quantum signatures; renew certificates; IoT probes with PQC support in their next cycle | Medium-high | L. Méndez |
| Ongoing | Throughout the period | Monitoring of suppliers and of regulatory developments; annual review of the Z estimate | Low | L. Méndez |
The shape of the roadmap is the lesson: the big spending comes at the end and can be avoided if research stalls; the small spending comes at the beginning and is useful whatever happens. Inventorying, classifying and requiring crypto-agility are valuable even if the quantum computer never arrives, because they improve cryptographic hygiene today. That is what makes this a prudent decision and not a gamble.
- Not buying hot air: how to spot brochure "quantum"
The quantum threat has generated a wave of products promising "quantum security" with little or no substance. The warning signs, so that Laura does not sign a useless contract:
| Sign of hot air | Why to be wary |
|---|---|
| "Unbreakable quantum encryption" without saying whether it is PQC or QKD | They are different things; QKD almost never applies and PQC is not "unbreakable", it is "resistant according to current knowledge" |
| "Based on quantum technology" for a number generator | A good random number generator is useful, but it does not protect against Shor: do not confuse entropy with quantum resistance |
| A proprietary, secret algorithm "more secure than the standards" | Kerckhoffs's principle from Module 2: security does not lie in keeping the algorithm secret. An algorithm that has not been through public scrutiny is a risk, not an advantage |
| Sales urgency: "migrate now or you'll be vulnerable tomorrow" | The threat is real but not imminent; false urgency is a sales tactic |
| No mention of hybrid modes | Anyone who knows the SIKE case deploys hybrid; anyone selling "pure post-quantum only" has not understood the risk |
| Promises regulatory compliance with a regulation still being defined | The specific obligations are still being worked out; nobody can "guarantee compliance" with something that has not been finalised |
The golden rule: the right answer for an SME is not bought; it is inherited and required. It is inherited from updated tools (browsers, servers, SSH clients that already come with hybrids) and required by contract (crypto-agility and adoption of standards). Any product that asks for a large, specific investment in 2029 to "protect you from the quantum computer" deserves, at the very least, the question: "what does this do that the updates to what I already have won't give me for free?".
- Common Mistakes and Tips
Mistake 1 — Believing the quantum computer is "a faster computer". Tip: it is a machine that is good at a handful of specific problems and bad at everything else. Its threat is specific: Shor against asymmetric cryptography. Understanding this avoids both panic and complacency.
Mistake 2 — Being alarmed by the qubit figures in the headlines. Tip: always ask "physical or logical?". Breaking RSA-2048 requires of the order of millions of high-quality physical qubits; the headlines talk about hundreds of physical qubits and often zero stable logical ones. The distance is orders of magnitude.
Mistake 3 — Concluding that, since it is years away, nothing needs doing. Tip: the harvest now, decrypt later argument makes the threat to data with long confidentiality current, and migration is slow. Starting to inventory and classify today is not premature: it is exactly right.
Mistake 4 — Spending on post-quantum AES or on "new quantum hashes". Tip: they neither exist nor are needed. Symmetric cryptography and hashes only need large sizes: AES-256 and SHA-384. PQC only replaces the asymmetric part.
Mistake 5 — Migrating systems without classifying the data first. Tip: urgency is set by the data, not the system, via Mosca's rule. Migrating a system with short-X data first while the employment records remain exposed is wasted effort.
Mistake 6 — Deploying "pure" post-quantum and ignoring the SIKE case. Tip: these algorithms are new. Hybrid modes —classical + post-quantum together— are the correct practice today, because they protect you even if one of the two fails. It is defence in depth applied to cryptography.
Mistake 7 — Hard-wiring the algorithm throughout the code. Tip: crypto-agility. Centralise the choice of algorithm in a single configurable point, so that the future migration means changing one place rather than an archaeological dig through the whole system.
Mistake 8 — Forgetting suppliers. Tip: most of your cryptography is implemented by third-party software. The crypto-agility clause and the question about their PQC plans, as part of supplier due diligence, are worth more than anything you do in your own code.
Mistake 9 — Mistaking QKD for the solution. Tip: QKD is expensive, limited hardware and it does not remove the need for PQC. For an SME, the solution is PQC in software. The leading authorities recommend PQC over QKD.
Mistake 10 — Buying brochure "quantum security". Tip: the answer is inherited from updated tools and required by contract. Faced with any product, ask what it does that the updates to what you already have will not give you for free.
Exercises
Exercise 1 — Apply Mosca's rule
Rutalia handles the following data. With Y = 3 years (migration) and a conservative Z of 10 years (arrival of the quantum computer):
- (a) CCTV camera recordings (retained for 30 days).
- (b) Staff employment contracts (retained for as long as the relationship lasts plus the legal limitation periods: decades).
- (c) Data on a shipment already delivered and invoiced (commercial relevance ~2 years).
- (d) The private key of Rutalia's internal CA, which signs all the certificates.
For each one: estimate X, apply X + Y > Z and say whether protecting it against the quantum computer is urgent. Justify case (d), which has a particular feature.
Exercise 2 — Classify the threat to the course's cryptography
For each item, state which algorithm protects it, whether the quantum computer affects it, by means of which algorithm (Shor or Grover), the severity and the mitigation:
a) Establishing the TLS 1.3 session when a customer logs in to MiRutalia.
b) Encryption of the restic backups at rest.
c) The internal CA's signature on an IoT probe's certificate.
d) The HMAC that protects the integrity of a session token.
e) Diego's SSH access to srv-db01.
Exercise 3 — Reject (or accept) an offer
A salesperson offers Andrés Vidal a "quantum cybersecurity solution" for €24,000 in the first year: a device that "generates unbreakable quantum keys with a next-generation proprietary algorithm, guarantees compliance with European quantum regulations and protects your data against the imminent quantum threat". Andrés forwards you the email asking whether he should sign.
a) Identify four signs of hot air in the description. b) What specific questions would you ask the salesperson? c) What is the right answer, and what should Rutalia do instead, with its cost? d) Write the three-sentence reply you would give Andrés.
Solutions
Solution to Exercise 1
| Data | Estimated X | X + Y > Z (Y=3, Z=10) | Urgent? |
|---|---|---|---|
| (a) Cameras (30 days) | ~0.1 years | 3.1 > 10 → false | No. By the time the machine exists, the data will have been deleted years before |
| (b) Employment contracts | Decades | >> 10 → true | Yes, top priority. Their secrecy must last well beyond the quantum horizon |
| (c) Delivered shipment | ~2 years | 5 > 10 → false | No. The commercial value expires long before the threat |
| (d) The CA's private key | Special (see below) | — | Yes, but for a different reason |
Case (d) has an important particular feature. The CA's key is not "data with a confidentiality lifetime" in the usual sense: it is the key that signs the trust of the whole organisation. If an attacker compromises it —capturing it today, breaking it tomorrow with Shor—, they can forge any Rutalia certificate: impersonate MiRutalia, impersonate servers, impersonate probes. Its urgency comes not from X (how long it must remain secret) but from its systemic role: it is a single point of trust whose compromise affects everything. In addition, the signatures it produces (certificates) have their own lifetime. That is why migrating the PKI to post-quantum signatures is phase 4 of the roadmap and deserves specific planning, even though it is not the first thing to be touched (because changing it means reissuing everything that hangs off it).
The cross-cutting lesson: Mosca's rule classifies data, but keys that protect other keys need an analysis of their own, because their compromise propagates.
Solution to Exercise 2
| Item | Algorithm | Affected? | Route | Severity | Mitigation |
|---|---|---|---|---|---|
| (a) TLS 1.3 handshake | ECDHE (key agreement) + RSA/ECDSA (authentication) | Yes | Shor | CRITICAL | Hybrid ECDHE+ML-KEM exchange (already in browsers/servers); ML-DSA signatures in future |
| (b) restic backup encryption | AES-256 (the data) | Practically not | Grover | Low | None on AES-256. But check how the restic key is protected: if it depends on asymmetric cryptography, that is where the real risk lies |
| (c) CA signature on a cert. | RSA or ECDSA | Yes | Shor | CRITICAL | Migrate the CA to ML-DSA or SLH-DSA (phase 4); short-lived certificates in the meantime |
| (d) HMAC on a token | HMAC-SHA-256 | No | — | None | None: HMAC with a strong hash is secure against the quantum computer |
| (e) SSH access to srv-db01 | Ed25519 or ECDSA/RSA (authentication) + key exchange | Yes | Shor | HIGH | Hybrid exchange in SSH where the tool offers it; watch for the arrival of post-quantum SSH signatures |
Key observations:
- (a) and (e) are "harvest now, decrypt later" cases in their purest form: the session establishment can be captured today and broken tomorrow, exposing the session key and with it all the encrypted traffic of that session. That is why hybrid exchange is the first deployment priority.
- (b) illustrates mistake 4: the instinct is to be alarmed about the backups, but AES-256 holds. The risk lies not in the symmetric encryption of the data but in how the key is protected: if restic's master key is wrapped with vulnerable asymmetric cryptography, that is the link to check. Distinguishing "the data" from "the key that protects it" is exactly the kind of analysis the cryptographic inventory brings to light.
- (d) is the good news, recalled: HMAC is not affected. Integrity based on a strong hash survives.
Solution to Exercise 3
a) Four signs of hot air
- "Generates unbreakable quantum keys": it mixes concepts. If it refers to generating randomness, a good generator is useful but does not protect against Shor; if it refers to QKD, it is hardware that almost never applies. And "unbreakable" is not an honest term: PQC is "resistant according to current knowledge".
- "Next-generation proprietary algorithm": it violates Kerckhoffs's principle. A secret algorithm that has not been through the public scrutiny of the NIST process is a risk, not a guarantee. The SIKE case shows that even public, heavily studied algorithms fall; a secret one offers no confidence at all.
- "Guarantees compliance with European quantum regulations": the specific obligations are still being defined. Nobody can "guarantee compliance" with something that has not yet been finalised. It is an empty promise.
- "Imminent quantum threat": false sales urgency. The threat is real but not imminent (10-20 years with great uncertainty); "imminent" is a sales tactic. And it does not mention hybrid modes, which suggests the seller has not understood the state of the art.
b) Questions for the salesperson
- Does your product implement algorithms standardised by NIST (ML-KEM, ML-DSA, SLH-DSA) or a proprietary algorithm? If proprietary, where is it published and who has analysed it?
- Is it PQC (software) or QKD (hardware)? If it is QKD, what fibre infrastructure does it require?
- Does it support hybrid modes (classical + post-quantum)?
- What exactly does your product do that the updates to my browser, my web server and my SSH client, which already negotiate hybrid exchanges, won't give me for free?
- Which specific regulation, with which article and which date of application, does it "guarantee compliance" with?
The answers will very probably show that the product contributes nothing that Rutalia cannot obtain by inheriting it and requiring it by contract.
c) The right answer
It is not signed. There is no problem this product solves that is not covered by the six actions in section 15, none of which costs €24,000:
- Cryptographic inventory: in-house hours (
inventario_cripto.py). - Classifying data using Mosca: in-house hours.
- AES-256, SHA-384, TLS 1.3: configuration, zero cost.
- Crypto-agility clause in contracts: zero cost.
- Hybrid modes: inherited free of charge from updated tools.
- Monitoring of suppliers and regulations: low, ongoing cost.
The real total cost of being reasonably prepared in 2029: practically zero in outlay, a few dozen hours of the team's time. Compared with €24,000 for a solution that, at best, duplicates what is already available free of charge and, at worst, introduces an unaudited proprietary algorithm.
d) Reply to Andrés
"Don't sign it. That product mixes up concepts that don't fit together —'unbreakable quantum keys' and a 'secret proprietary algorithm' are, in security, warning signs, not signs of quality— and it would charge us €24,000 for something we largely already get free with the updates to the systems we use.
The quantum threat is real, but it isn't imminent: we're talking about ten to twenty years with a lot of uncertainty, and the sensible thing is to start inventorying and classifying our data now, not to rush into buying an expensive box.
I have a phased plan, approved by the committee, that leaves us prepared with almost zero outlay this year; I can show it to you in five minutes whenever you like."
Notice that the reply, like all the good security answers in this course, says "no" and at the same time offers the alternative that addresses the underlying legitimate concern.
Conclusion
You have closed the module by returning to the start of the course, to the cryptography of Module 2, in order to secure it against a future that is already shaping the present. And you have done so with the technical honesty that has guided the whole of Module 7: separating what is established from what is speculative, and stating clearly what is known and what is not.
You know what a quantum computer really is: qubits, superposition, entanglement and the fragility of decoherence, with the distinction that demolishes almost every headline —physical versus logical qubits—. You know that it is not a faster computer: it is a machine that is good at a handful of problems and bad at everything else, and that by a historical coincidence two of those problems underpin asymmetric cryptography.
You can distinguish precisely what it breaks and what it does not. Shor's algorithm destroys RSA, Diffie-Hellman and ECC, that is, almost all the public-key security you have deployed during the course: the TLS handshake, SSH, the VPN, the PKI, signatures and even the certificates for the new probes. Grover's algorithm only halves the strength of symmetric cryptography and hashes, with a reassuring rule of thumb: doubling the size is enough, AES-256 and SHA-384 hold up. The urgent problem is Shor, not Grover, and you have the table that sums it up by heart: the asymmetric gets replaced, the symmetric just grows.
You understand the real state of the technology —the gap of orders of magnitude between today's hundreds of physical qubits and the millions that would be needed—, why the community talks of 10 to 20 years with enormous uncertainty, and why that uncertainty is no excuse: because of the harvest now, decrypt later argument, which turns the threat to data with long confidentiality into a present-day problem, with the 11.42 GB from INC-2028-014 and records that must stay secret for decades as the example. And you know how to calculate it with Mosca's formula —X + Y > Z—, which teaches the most important management lesson in the lesson: urgency is set by the data, not the system, and the work starts with classifying, not migrating.
You know post-quantum cryptography: what it is, which independent mathematical families it rests on, and why NIST's public, adversarial process is what gives confidence in ML-KEM, ML-DSA and SLH-DSA. You know that they have larger keys and signatures, which makes the migration an engineering project. And you have firmly in mind the lesson in humility of the SIKE case —a candidate broken with a laptop— which justifies hybrid modes, defence in depth applied to cryptography, which are already being deployed in browsers and in SSH and which an SME inherits rather than implements. You also know why QKD is not the solution for Rutalia.
And, above all, you know what to do today, which is the heart of the lesson and costs almost nothing: inventory the cryptography —you have done it in code, reusing vigilar_certificados.py from 02-05—, require crypto-agility in contracts and development, upgrade the cheap things now, classify data by confidentiality horizon, keep an eye on suppliers and plan the PKI, and do not buy hot air. With a roadmap whose big spending comes at the end and can be avoided, and whose small spending comes at the beginning and is useful whatever happens. That shape —starting to put the house in order without betting on a date— is the right answer to a threat that is distant but involves a slow migration, and it is, at heart, risk management done properly.
And with this, Module 7 comes to a close, and with it the part of the course that looks ahead.
You have explored the four technologies that are shifting the ground beneath your feet. Artificial intelligence, in its three roles: the one that defends, the one that attacks with Andrés Vidal's cloned voice, and the one that becomes an attack surface when jlopez pastes the customer portfolio into an assistant. Blockchain, demystified to the point of discovering that you almost never need it and that the real problem it brings Rutalia is cryptojacking on its servers. The Internet of Things, where the fourteen A006 probes stopped being a footnote and became the asset whose compromise could end with spoiled food on someone's table. And quantum computing, the only threat that has not yet happened and that already forces you to decide.
From all four, you learned the same underlying lesson, repeated in four different languages: emerging technologies do not repeal the fundamentals; they demand them. Prompt injection is access control. Blockchain security is key management. IoT defence is segmentation and inventory. Quantum readiness is data classification and crypto-agility. Nothing you learned in Modules 1 to 6 has expired; all of it has become more necessary. And in each of them you took, with Rutalia, the same kind of mature decision: a reasoned, documented "no", with its alternative, its monitoring action and its review conditions. Because knowing when not to act, and putting it in writing, is as much a part of security as knowing when to act.
Now it is time to come back to the present and turn the whole course into something sustainable. In Module 8 you will stop looking at specific technologies and build the programme that governs them all: secure software development —where crypto-agility and the dependencies you have named become engineering practice—, formal risk management that turns the decisions you have been taking on judgement into a method, the awareness and training that makes people the first line of defence rather than the weak link, the metrics, SOC and continuous improvement that turn security into an observable state, and finally the Final Project: the Security Master Plan for Rutalia, where everything you have learned —from the CIA triad to post-quantum cryptography— comes together in a single, prioritised, budgeted plan.
You have learned to defend, to test, to respond, to recover, to prove it and to look ahead. Now it is time to turn it into a programme that lasts.
