Skip to content

Cryptanalysis, Cryptographic Attacks and Diffie-Hellman Key Exchange

Classical and modern cryptanalysis, side channels, padding oracles, post-quantum readiness and the Diffie-Hellman key exchange.

Last updated:

Share

Cryptanalysis is the discipline of breaking cryptographic systems, sorting attack methods by what an adversary can access: from ciphertext-only at the weakest end through adaptive chosen-ciphertext at the strongest. Statistical techniques such as differential and linear cryptanalysis shaped the design of modern block ciphers like AES, while side-channel attacks exploit the physics of a correct implementation rather than its mathematics. Diffie-Hellman key exchange (1976) underpins Perfect Forward Secrecy in TLS 1.3, SSH, and Signal by letting two parties derive a shared secret over a public channel without transmitting it, relying on the computational difficulty of the discrete logarithm problem.

Cryptanalysis is the half of cryptography that breaks things. The discipline is older than digital computing (Al-Kindi's frequency analysis dates to the ninth century, and Alan Turing's Bombe broke Enigma in the 1940s) and is what keeps the algorithms in active use honest. A digital forensic examiner is rarely the cryptanalyst, but is regularly the person who has to recognise a broken cipher in evidence: a TLS 1.0 server still serving CBC with no MAC, a .zip file with a known-plaintext header, an Android backup encrypted with a derived key from a four-digit PIN, or an Indian CA's CRL signed with SHA-1 in 2018. Knowing the names of the attacks lets the examiner write a report that survives cross-examination on Section 39 BSA grounds.

Key takeaways

  • The classical attack taxonomy sorts attacks by what the attacker has access to, from ciphertext-only at the weakest end through adaptive chosen-ciphertext at the strongest, and examiners should be able to name the correct class when reporting a broken implementation.
  • Real-world deployment failures have produced famous breaks: the 2008 Debian OpenSSL weak-key bug, the PS3 ECDSA nonce reuse disaster, POODLE against SSL 3.0 CBC, and Logjam against export-grade Diffie-Hellman.
  • Side-channel attacks break correct algorithms running on real hardware by measuring timing differences, power consumption, cache access patterns, or electromagnetic emissions rather than attacking the cipher's mathematics.
  • Diffie-Hellman key exchange underpins Perfect Forward Secrecy in TLS 1.3, IPSec IKEv2, SSH and Signal, meaning a compromise of the long-term private key does not retroactively expose recorded session traffic.
  • Shor's algorithm on a sufficiently large quantum computer can break RSA and classical Diffie-Hellman, which is why NIST published its first post-quantum cryptography standard finalists in 2024 and the CCA has a roadmap for migration.

This topic walks the canonical attack catalogue (ciphertext-only through adaptive chosen-ciphertext), the statistical attacks that shaped modern block-cipher design (differential and linear cryptanalysis), the side channels that break correct algorithms running on real hardware (timing, power, cache, EM), the deployment-level failures that have produced famous cases (Debian OpenSSL 2008, the PS3 ECDSA disaster, POODLE, Logjam), and the quantum threat that is reshaping standards (Shor and Grover, with NIST's 2024 PQC finalists). It closes with the Diffie-Hellman key exchange in detail, because DH (and its elliptic-curve cousin ECDHE) is the single primitive that powers Perfect Forward Secrecy in TLS 1.3, IPSec IKEv2, SSH and Signal. The Indian dimension is concrete: the CCA roadmap on post-quantum migration and IDRBT's published papers on banking-sector PQC pilots.

By the end of this topic you will be able to:

  • Classify a cryptographic attack by its model, ciphertext-only, known-plaintext, chosen-plaintext, chosen-ciphertext, or adaptive, and explain what distinguishes each.
  • Describe how differential and linear cryptanalysis work at a conceptual level, and explain why AES was designed to bound both biases.
  • Identify the side-channel category (timing, power, cache, EM, acoustic) that applies to a given attack scenario and name the corresponding mitigation.
  • Trace the Diffie-Hellman key exchange step by step, explain why an eavesdropper cannot recover the shared secret, and explain what additional mechanism prevents a man-in-the-middle attack.
  • Explain what Shor's algorithm does to RSA and classical DH, how Grover's algorithm affects AES-128 versus AES-256, and what the NIST 2024 PQC standards (ML-KEM, ML-DSA, SLH-DSA) replace.
Key terms
Cryptanalysis
The study of breaking cryptographic systems. Complement to cryptography. Goals include recovering the key, recovering the plaintext, or distinguishing a cipher's output from random.
Brute force
Exhaustive search over the key space. The benchmark every other attack must beat. AES-128 brute force is computationally infeasible on classical hardware; DES brute force is a one-day exercise on a modern GPU cluster.
Side-channel attack
Attack that exploits information leaked by a correct implementation: timing, power consumption, electromagnetic emanation, cache state, acoustic noise. Independent of the algebra of the cipher.
Padding oracle
An attack that uses an error-message distinction (or a timing distinction) between 'padding invalid' and 'authentication invalid' to recover plaintext from CBC-mode ciphertext without the key.
Perfect Forward Secrecy (PFS)
Property of a key exchange where compromise of a long-term private key does not let the attacker decrypt past sessions. Achieved by ephemeral Diffie-Hellman (DHE or ECDHE).
Post-Quantum Cryptography (PQC)
Algorithms designed to resist attacks by sufficiently capable quantum computers. NIST standardised CRYSTALS-Kyber as ML-KEM and CRYSTALS-Dilithium as ML-DSA in 2024.
Diffie-Hellman
Key exchange protocol by Diffie, Hellman and Merkle (1976) that lets two parties agree on a shared secret over a public channel. Security rests on the discrete logarithm problem.

The attack taxonomy every examiner should be able to recite

The Kerckhoffs-style classification of attacks is the foundation. It sorts attacks by the kind of access the attacker is assumed to have, from the weakest (ciphertext only) to the strongest (adaptive chosen-ciphertext with side-channel access). The point of the classification is that a cipher claimed to be secure under chosen-ciphertext attack is much stronger than one only secure against ciphertext-only adversaries. Modern AEAD ciphers like AES-GCM are designed to resist the strongest model.

Attack modelAttacker hasGoalExample real-world setting
Ciphertext-onlyOnly ciphertextsRecover key or plaintextIntercepted radio traffic of unknown protocol
Known-plaintextPlaintext + ciphertext pairs from past trafficRecover the key usedA captured WPA2 handshake with a known SSID
Chosen-plaintext (CPA)Can ask for encryption of any plaintextDistinguish ciphertexts or recover keyAttacker who can inject HTTP requests through a victim's browser
Chosen-ciphertext (CCA1, CCA2)Can ask for decryption of chosen ciphertexts (not the target)Recover plaintext or distinguishBleichenbacher attack on PKCS#1 v1.5 RSA
Adaptive chosen-ciphertextDecryption oracle queries can depend on previous answersStronger plaintext recoveryPOODLE on SSL 3.0 padding
Side-channelTiming, power, EM or cache observations from a correct implementationRecover key or nonceCache-timing attack on AES on a shared cloud VM

Practical examiner work crosses the levels. A WPA2 capture is a known-plaintext scenario where the four-way handshake exposes structured material that a dictionary attack on the PSK can exploit. A captured Indian government tender encrypted with a misconfigured AES-CBC blob without authentication may admit a padding-oracle attack if the server returns distinguishable errors. A side-channel attack on a smart-card-based Class 3 DSC token is a research-grade exercise and is one of the threats CCA-licensed CAs explicitly require their tokens to be certified against.

Statistical and algebraic cryptanalysis

Two attacks reshaped modern block-cipher design. Differential cryptanalysis, published openly by Biham and Shamir in 1990 (and known internally to IBM and the NSA when they designed DES in the 1970s, which is why DES's S-boxes look the way they do), studies how chosen differences between plaintext pairs propagate through the rounds of a cipher to ciphertext differences. If a particular input difference produces a particular output difference with probability much higher than uniform, that bias can be exploited to recover key bits. Differential cryptanalysis is the reason AES uses an S-box with provable maximum differential probability and a wide-trail strategy that bounds differential propagation across rounds.

Linear cryptanalysis, due to Matsui in 1993, looks for linear approximations between plaintext bits, ciphertext bits and key bits that hold with probability significantly different from one-half. The first attack on full DES with practical data complexity (2^43 known plaintexts) was Matsui's linear cryptanalysis. AES's S-box is also designed to bound linear bias, which is why AES has resisted both kinds of statistical attack across 25 years of study.

  1. Pick a candidate bias
    For differential, choose an input difference delta_x with a non-uniform output-difference distribution after one or two rounds. For linear, find a linear equation over plaintext, ciphertext and key bits that holds with probability one-half plus epsilon.
  2. Build a multi-round characteristic
    Chain the single-round bias across multiple rounds. The end-to-end probability is roughly the product of per-round probabilities for differential, or compounded by Matsui's piling-up lemma for linear.
  3. Collect data
    For differential, gather chosen-plaintext pairs with the chosen input difference. For linear, gather known plaintext-ciphertext pairs. The data complexity scales as 1 / epsilon^2.
  4. Recover key bits
    Guess the last-round subkey, partially decrypt each pair, count how often the predicted bias appears. The correct guess produces the strongest signal.
  5. Extend to full key
    Iterate over rounds or use a meet-in-the-middle layer to recover remaining key bits, then verify with one trial decryption.

Algebraic cryptanalysis models a cipher as a system of polynomial equations and attempts to solve it. The XL and XSL families were proposed against AES in the early 2000s; in practice they have not yielded a break of AES, and the consensus is that AES is not vulnerable to currently known algebraic attacks. Meet-in-the-middle attacks apply to multi-encryption schemes: 2DES (double-encrypting under two independent DES keys) gives only about 57 bits of effective security against a meet-in-the-middle attack rather than the 112 bits naive analysis would suggest, which is precisely why Triple DES uses three encryptions in EDE mode to land at 112 bits of effective security.

Side-channel attacks: timing, power, cache, EM, acoustic

A cipher can be mathematically secure and still bleed key material through the physics of the device running it. Side-channel attacks treat the implementation as the target, not the algebra. They are the reason modern crypto code spends extra cycles to run in constant time, the reason HSMs are tamper-resistant in a specific certified way, and the reason a Class 3 DSC USB token must be FIPS 140-2 Level 2 or higher.

Timing attacks exploit the variation in how long an operation takes when it branches on secret data. Kocher's 1996 paper showed that RSA private operations leaked the private exponent bit by bit through measurable timing differences. The fix is constant-time arithmetic: every code path takes the same number of cycles regardless of the secret. Lucky 13 (AlFardan and Paterson 2013) was a timing attack against TLS 1.0 record processing that recovered plaintext through the timing of MAC computation; it forced the move to AEAD ciphers.

Power analysis comes in two flavours. Simple Power Analysis (SPA) reads off the power trace of a single operation and identifies key bits directly from the visible structure of the trace (the difference between a multiply step and a square step in an RSA exponent ladder, for example). Differential Power Analysis (DPA), introduced by Kocher, Jaffe and Jun in 1999, statistically correlates power traces across many operations with hypotheses about intermediate values to recover the key. Smartcards and HSMs are designed and certified specifically against DPA, with randomised power profiles, dummy operations and masking.

Cache-timing attacks exploit shared L1/L2/L3 caches on modern CPUs. Flush+Reload (Yarom and Falkner 2014) and Prime+Probe attacks can recover AES keys across virtual machines on the same physical host by observing cache line access timings. Cloud deployments running AES without the AES-NI instruction (which executes in constant time) on shared hosts are the realistic target; this is one reason every major Indian bank has migrated its core AES paths to AES-NI hardware.

Side channelWhat leaksReal attackMitigation
TimingVariable-time operations leak secret-dependent branchesKocher 1996 on RSA; Lucky 13 on TLS CBC-MACConstant-time implementations; AEAD
Simple Power Analysis (SPA)Power trace of one operation reveals structureSPA on smartcard RSA exponent ladderSquare-and-multiply-always; Montgomery ladder
Differential Power Analysis (DPA)Correlation across many tracesDPA on smartcard AESMasking; randomisation; certified tokens
Cache timingCache hit/miss reveals access patternFlush+Reload on AES T-tables across cloud VMsAES-NI constant-time; table-free AES; bitsliced AES
Electromagnetic (EM)EM emanation correlates with computationTromer et al on RSA via near-field probeShielded enclosures; TEMPEST-rated rooms
AcousticCPU noise correlates with computationGenkin et al RSA key extraction from coil whineStandard physical security; environment noise

Padding oracles, length extension and implementation disasters

Several major cryptographic failures of the past 25 years were not weaknesses in the underlying algorithms. They arose from protocols that wrapped a correct cipher in a structure leaking information through error messages, length fields, or random-number generation.

The padding-oracle attack on CBC mode was first published by Vaudenay in 2002. CBC-mode ciphertexts use PKCS#7 padding so the plaintext length matches a block boundary; a decryptor checks the padding after decrypting. If the protocol returns one error for "bad padding" and a different error (or even just a different timing) for "padding fine but authentication failed", an attacker can recover plaintext byte by byte by sending crafted ciphertexts and watching which response comes back. BEAST (Duong and Rizzo 2011) and POODLE (Moller et al 2014) are the famous TLS realisations. The structural fix is encrypt-then-MAC or true AEAD: AES-GCM and ChaCha20-Poly1305 verify authenticity before any padding check, so the oracle never opens.

Length-extension attacks against bare SHA-1 and SHA-256 in MAC constructions (computing H(key + message) and treating the result as a tag) let an attacker append data to the message and compute a valid tag without knowing the key. HMAC (RFC 2104) eliminates this by its double-hashing construction. Forensic candidates frequently see this in legacy Indian banking APIs that signed requests with naive concatenation hashing before migrating to HMAC-SHA-256.

The Indian-context lesson is concrete. CCA-licensed CAs require their HSMs and DSC tokens to be FIPS 140-2 Level 3 certified specifically to defend against the class of failures that produced Debian OpenSSL 2008 (weak RNG) and PS3 (predictable nonce). When a forensic examiner is asked whether a signature is valid, the algebra of the signature is only the start; the question of whether the private key generation was sound is what separates a confident report from a hedged one.

Quantum threats and the NIST post-quantum standards

Quantum computing changes the cryptanalytic threat model in a specific, predictable way. Two algorithms matter. Shor's algorithm (1994) factorises integers and solves discrete logarithms in polynomial time on a sufficient-scale quantum computer, which breaks RSA, DSA, ECDSA and classical Diffie-Hellman completely. Grover's algorithm (1996) gives a quadratic speed-up for unstructured search, which halves the effective security of symmetric ciphers: AES-256 retains about 128 bits of post-quantum security, while AES-128 drops to about 64 bits.

The practical timeline is uncertain but the policy response is not. NIST ran a multi-year Post-Quantum Cryptography standardisation process and in 2024 published the first set of finalists as standards. CRYSTALS-Kyber became ML-KEM (Module-Lattice Key Encapsulation Mechanism, FIPS 203) for key establishment. CRYSTALS-Dilithium became ML-DSA (Module-Lattice Digital Signature Algorithm, FIPS 204) for signatures. SPHINCS+ became SLH-DSA (Stateless Hash-Based Digital Signature Algorithm, FIPS 205) as a conservative hash-based signature backup. Falcon, a compact lattice-based signature, was queued as a fourth standard. The Indian dimension is active: CCA India's working group on PQC has issued draft guidance for licensed CAs and IDRBT has published pilot papers on hybrid TLS (ECDHE + ML-KEM) for banking-sector trials.

PrimitiveClassical securityPost-quantum securityPQC successor
RSA-2048112-bitBroken (Shor)ML-KEM (for KEM); ML-DSA (for signatures)
RSA-3072128-bitBroken (Shor)ML-KEM; ML-DSA
ECDH P-256128-bitBroken (Shor)ML-KEM
ECDSA P-256128-bitBroken (Shor)ML-DSA; SLH-DSA; Falcon
AES-128128-bit~64-bit (Grover)Move to AES-256
AES-256256-bit~128-bit (Grover)Stay on AES-256
SHA-256256-bit (pre-image)~128-bit (Grover)Acceptable; consider SHA-384 / SHA-512 for long horizons

Diffie-Hellman, ECDHE and Perfect Forward Secrecy

Diffie-Hellman key exchange was published by Diffie, Hellman and Merkle in 1976 as the first practical mechanism for two parties to agree on a shared secret over an eavesdropped channel without prior contact. The mathematics is compact enough to present in full.

  1. Public parameters
    A large prime p (2048-bit or larger today) and a generator g of a multiplicative subgroup mod p. These are public; everyone uses the same parameters.
  2. Alice's contribution
    Alice picks a random secret integer a (her private key). She computes A = g^a mod p and sends A to Bob over the public channel.
  3. Bob's contribution
    Bob picks a random secret integer b. He computes B = g^b mod p and sends B to Alice.
  4. Shared secret
    Alice computes K = B^a mod p = g^(ab) mod p. Bob computes K = A^b mod p = g^(ab) mod p. They now share K.
  5. Eavesdropper's problem
    An eavesdropper sees p, g, A and B but not a or b. Recovering K requires solving the discrete logarithm problem in the group, which is computationally infeasible for the right group sizes.

DH on its own does not authenticate. An active attacker can sit between Alice and Bob, run two separate DH exchanges (one with each), and read everything that passes. The fix is to sign the DH exchange with a long-term key (the server's RSA or ECDSA private key in a TLS handshake), which lets the client verify it is talking to the holder of the certificate. TLS 1.2 and 1.3 do exactly this: ECDHE for the key exchange and an RSA or ECDSA signature over the handshake transcript for authentication.

Diffie-Hellman key exchange sequence with MITM attack point. Alice and Bob agree on public parameters g and p, exchange their
Diffie-Hellman key exchange sequence with MITM attack point. Alice and Bob agree on public parameters g and p, exchange their public values (g^a mod p and g^b mod p), and independently compute the shared secret g^(ab) mod p. Mallory's interception point is highlighted: she substitutes her own DH values to each party, giving her two shared secrets and full visibility into all traffic.

Ephemeral DH (DHE for finite-field, ECDHE for elliptic-curve) delivers Perfect Forward Secrecy. Each session generates fresh DH parameters that are discarded at session end. Even if the server's long-term private key is later compromised, recorded session traffic stays unreadable because the session keys cannot be reconstructed without the discarded ephemeral secrets. TLS 1.3 makes ECDHE mandatory; static RSA key transport, which lacked PFS, was removed. UPI message-layer cryptography still uses RSA key transport for backward compatibility, which is one of the reasons CCA and NPCI roadmaps include a planned move to ECDHE-style ephemeral channels.

ECDHE handshake in TLS 1.3 delivering Perfect Forward Secrecy. The client and server each generate an ephemeral elliptic-curv
ECDHE handshake in TLS 1.3 delivering Perfect Forward Secrecy. The client and server each generate an ephemeral elliptic-curve key pair, exchange public keys, and derive the shared secret on each side. The server signs the transcript with its long-term ECDSA key from a CCA-licensed CA so the client can authenticate. The shared secret is run through HKDF to produce AES-GCM keys, and the ephemeral private keys are destroyed at session end. A future compromise of the long-term ECDSA key does not let the attacker decrypt this session.

Logjam (Adrian et al 2015) is the cautionary tale on the DH side. Many TLS servers in 2015 still supported export-grade 512-bit DH groups for backward compatibility with 1990s clients. An active attacker could downgrade the handshake to a 512-bit group and then break the discrete log in under a minute with precomputation. Worse, many servers shared the same 1024-bit DH group, which made one-time precomputation worthwhile against a large pool of targets. The fix is to disable export ciphers, use unique 2048-bit or larger DH parameters per server, and prefer ECDHE on standardised curves (P-256, X25519) which have no equivalent precomputation shortcut. Indian government sites took several years after Logjam to complete this migration; CERT-In advisories in 2016 and 2017 specifically called it out.

ElGamal is the signature variant of Diffie-Hellman and a building block in DSA and in OpenPGP encryption. It appears in DNSSEC algorithm allocations and in some legacy PKI material; for current Indian PKI work the practical scheme is ECDSA on P-256 or Ed25519 rather than ElGamal directly.

Key management determines whether the mathematics above translates into actual security in practice. Generation must use a vetted RNG. Distribution must not pass private keys over the network. Escrow is politically controversial in India (the IT Act decryption rules under Section 69 sit at the edge of the issue). Rotation must be scheduled and tested. Revocation must publish through CRL and OCSP. Destruction must be verifiable. Hardware Security Modules (HSMs) handle high-value keys (CCA root keys, NPCI signing keys, IDRBT bank-grade keys) inside FIPS 140-2 Level 3 or higher tamper-resistant boundaries. Cross-link with Asymmetric Cryptosystems, Hashing, PKI and Digital Signatures for the PKI and DSC detail and with Cryptography Fundamentals for the historical attack vocabulary.

Practice
Question 1 of 5· 0 answered

Which cryptanalysis technique introduced by Biham and Shamir in 1990 studies how chosen differences between plaintext pairs propagate to ciphertext differences?

Frequently asked questions

What is the practical difference between known-plaintext and chosen-plaintext attacks?
In a known-plaintext attack the adversary observes plaintext-ciphertext pairs that already exist (intercepted traffic with predictable headers, for example). In a chosen-plaintext attack the adversary can submit arbitrary plaintexts of their choice and see the ciphertexts; this is a stronger model. A cipher claimed to be CPA-secure offers stronger guarantees than one only secure against known-plaintext adversaries.
Why is AES-NI hardware acceleration treated as a security feature, not just a performance feature?
Software implementations of AES that rely on lookup tables can leak key material through cache-timing side channels (Flush+Reload, Prime+Probe) when running alongside an attacker on a shared cloud host. The AES-NI instructions execute in constant time and do not consult data-dependent cache lines, which closes the cache-timing channel. CCA interoperability guidance and IDRBT pilots prefer AES-NI for these reasons.
Does a sufficiently capable quantum computer break AES-256?
No, but it weakens it. Grover's algorithm gives a quadratic speed-up for unstructured search, which means AES-256 retains about 128 bits of effective post-quantum security against brute force. AES-128 drops to about 64 bits, which is why post-quantum migration plans favour AES-256 across the board. Shor's algorithm does not apply to symmetric ciphers.
What is the harvest-now-decrypt-later threat?
A state-level adversary today captures encrypted traffic that is protected by RSA, ECDH or classical Diffie-Hellman and stores it. When a sufficient-scale quantum computer arrives, the adversary uses Shor's algorithm to recover the long-term keys and decrypt the archived traffic. Data with a long secrecy horizon (state cables, banking ledgers, archived medical records) is at risk now, even if the quantum computer is years away. CCA India and IDRBT roadmaps target hybrid PQC migration starting 2026 to 2028 specifically against this threat.
Why was Logjam (2015) such a serious finding?
Logjam showed that many TLS servers still supported export-grade 512-bit DH groups for backward compatibility, and that an active attacker could downgrade the handshake to such a group and break the discrete logarithm in under a minute. It also showed that many servers shared the same 1024-bit group, which made one-time precomputation worthwhile against an entire pool of targets. The fix was to disable export ciphers, use unique 2048-bit or larger DH parameters per server, and prefer ECDHE on standardised curves like P-256 or X25519.
What does Perfect Forward Secrecy actually guarantee?
PFS guarantees that compromise of a server's long-term private key in the future cannot let an attacker decrypt past sessions recorded today. Each session generates fresh ephemeral DH or ECDHE keys that are destroyed at session end. TLS 1.3 makes ECDHE mandatory; this is one of the reasons the protocol is recommended for Indian banking and government deployments.
How are Indian CAs preparing for the post-quantum transition?
CCA India has issued draft guidance for licensed CAs covering hybrid certificate issuance (classical algorithm plus a post-quantum algorithm such as ML-DSA), HSM upgrades certified for PQC primitives, and timelines aligned with the NIST FIPS 203, 204 and 205 standards. IDRBT has published pilot papers on hybrid TLS using ECDHE plus ML-KEM in banking-sector trials. The expectation across CCA-licensed CAs (eMudhra, Sify, Capricorn, IDRBT and others) is a phased migration starting 2026 to 2028.

Test yourself on Digital Forensics with free, timed mocks.

Practice Digital Forensics questions

Found this useful? Pass it along.

Share

Spotted an error in this page? Report a correction or read our editorial standards.

Your journey to becoming a forensic professional starts here.

Practice with mock tests, learn from structured notes, and get your questions answered by a global forensic community, all in one place.