>
HomeLTE 4GPDCP โ€” Packet Data ConvergenceCiphering & Integrity
๐Ÿ›ก๏ธ PDCP โ€” Packet Data ConvergenceAdvanced

Ciphering & Integrity (EEA/EIA) in LTE 4G

How PDCP applies encryption and integrity using COUNT (HFN + SN) and the EEA/EIA algorithms.

📚 3GPP-basedTS 36.323TS 33.401

Once your phone and the network share a secret key, every bit that crosses the air can be scrambled so an eavesdropper sees only noise, and every signalling message can be stamped so nobody can forge or replay it. In LTE that work lives in the PDCP layer — ciphering (confidentiality) and integrity protection (authenticity) — defined by TS 36.323 (the PDCP protocol) and TS 33.401 (the SAE/LTE security architecture). This page walks the whole machine: the algorithm families, the COUNT that must never repeat, the five inputs to each computation, the 32-bit MAC-I, the AS key set, and how it is all switched on.

Introduction

PDCP security is the access-stratum (AS) protection that LTE applies at the PDCP layer — ciphering for confidentiality and integrity protection for authenticity and replay defence. It is defined jointly by TS 36.323, which fixes where in the PDCP PDU the transforms apply and in what order, and TS 33.401, which defines the algorithms, the key hierarchy, and the exact inputs to each computation.

It comes to life partway through connection setup. The first RRC messages travel unprotected because no access-stratum key exists yet; once authentication has produced KeNB and the eNB has chosen an encryption and an integrity algorithm, the AS Security Mode Command procedure switches protection on. From that point every RRC message is ciphered and integrity-protected, and every user-data packet on a DRB is ciphered.

It matters because radio is a broadcast medium: without ciphering anyone nearby reads your traffic, and without integrity an attacker can forge or replay the very signalling that reconfigures your connection. The whole scheme rests on one counter, COUNT, that must never repeat under a key — understand that and the rest of PDCP security follows.

Why PDCP security is needed

๐Ÿ’ก

In plain words: sending over the air is like shouting across a crowded room โ€” everyone hears you. Ciphering is speaking in a private code only you and the network know, so eavesdroppers hear gibberish. Integrity protection is a wax seal on the envelope: the recipient can instantly tell if anyone opened it, changed a word, or tried to slip in an old letter again. Signalling — the messages that reconfigure your call — gets both the code and the seal; ordinary user data gets the code only.

Two independent threats drive the design. First, confidentiality: because anything transmitted can be captured by any nearby receiver, the payload must be unreadable to anyone without the key. Second, authenticity and freshness: an attacker who cannot read a message might still try to alter it, forge a new one, or replay an old valid one — especially dangerous for signalling that changes bearers, keys or handover targets. Ciphering answers the first threat; integrity protection with a per-packet counter answers the second. LTE applies both at PDCP because that is the one layer that sees every user- and control-plane packet after sequence numbering but before RLC.

What PDCP Security Does

Radio is a broadcast medium: anything you transmit, anyone with a receiver nearby can capture. LTE closes that hole at the PDCP layer, which sits between RRC/IP above and RLC below. As each packet passes through PDCP on its way down, two independent transforms can be applied — encryption so the contents are unreadable, and an authentication tag so the receiver can prove the packet was neither altered nor fabricated. On the way up the same transforms are undone and verified.

What

Two separate per-PDCP-entity functions: ciphering (confidentiality) and integrity protection (authenticity + replay protection). Each is a symmetric-key operation driven by a per-packet counter so identical plaintext never yields identical ciphertext.

Why

Without ciphering an attacker reads your traffic; without integrity an attacker can forge or tamper with the very signalling that reconfigures your connection. Signalling is the higher-value target, so it receives both protections while user data receives encryption only.

How

Ciphering XORs a key-derived keystream onto the payload. Integrity runs the message through a keyed function to produce a 32-bit MAC-I tag that the receiver independently recomputes and compares.

The division of labour is the single most important fact to hold onto. Ciphering is applied to both SRB (signalling radio bearers, which carry RRC and NAS) and DRB (data radio bearers, which carry user traffic). Integrity protection, in classic LTE, is applied to SRB only. There is no user-plane integrity in the original LTE design — a DRB is enciphered but not integrity-protected. So signalling gets encrypt-plus-integrity, while user data gets encrypt-only.

🎯

The split to remember: ciphering → SRB + DRB; integrity protection → SRB only. This is why the LTE AS key set (below) has an encryption key for the user plane but no integrity key for it.

๐Ÿ”€

LTE โ†” NR: NR (TS 38.323 / TS 33.501) renames the families EEA/EIA to NEA/NIA (with the same SNOW 3G / AES / ZUC bases and the same 4-bit ids) and makes per-DRB user-plane integrity (UP-IP) a first-class, configurable feature with a dedicated KUPint key — closing exactly the user-plane-integrity gap that classic LTE left open.

📘

Spec anchors: TS 36.323 defines where in the PDCP PDU ciphering and integrity apply and the order of operations; TS 33.401 defines the algorithm identities, the key hierarchy, and the exact input construction for the EEA/EIA functions. TS 35.215/35.216 (SNOW 3G) and TS 35.221/35.222 (ZUC) specify the underlying ciphers.

The Algorithms — EEA and EIA

3GPP deliberately does not bolt LTE to one cipher. It defines families of interchangeable algorithms, negotiated at connection setup, so that a future weakness in any one algorithm does not collapse the whole system — the network simply selects a different member of the family. The encryption family is EEA (EPS Encryption Algorithm) and the integrity family is EIA (EPS Integrity Algorithm). Each algorithm carries a 4-bit identity that the UE advertises in its UE EPS security capabilities and the network selects during the Security Mode procedure.

Encryption options are EEA0 (the null algorithm — no ciphering at all), EEA1 (built on the SNOW 3G stream cipher), EEA2 (built on AES in counter mode), and EEA3 (built on the ZUC stream cipher). Integrity options mirror them one-for-one: EIA1 (SNOW 3G), EIA2 (AES in CMAC mode), and EIA3 (ZUC). There is an EIA0 (null integrity), but it is permitted only for emergency calls placed by an unauthenticated UE — ordinary traffic must always select a real integrity algorithm, because signalling with no integrity is trivially forgeable.

Base cipherEncryption (EEA)4-bit IDIntegrity (EIA)4-bit IDMode / notes
NullEEA00000EIA00000No protection; EIA0 is emergency-call only
SNOW 3GEEA1 (128-EEA1)0001EIA1 (128-EIA1)0001Word-oriented stream cipher
AESEEA2 (128-EEA2)0010EIA2 (128-EIA2)0010AES-CTR for cipher; AES-CMAC for MAC
ZUCEEA3 (128-EEA3)0011EIA3 (128-EIA3)0011Chinese-standard stream cipher

All LTE AS keys are 128 bits, which is why the algorithms are also written as 128-EEA1, 128-EIA2, and so on — the leading 128 names the key length. Notice that the same base cipher can serve both jobs: EEA2 and EIA2 are both AES, but EEA2 runs it in a counter mode to generate a keystream for encryption, while EIA2 runs it in CMAC mode to generate a message authentication tag. Same primitive, different construction, different purpose.

💡

Why three real families? SNOW 3G and AES came first; ZUC was added largely so that markets requiring a domestically-specified cipher had a standardised, interoperable option. All three are considered strong; the network picks whichever the operator has provisioned as preferred among those the UE supports.

COUNT = HFN ‖ PDCP SN, and Why It Must Not Repeat

The heart of the whole scheme is a 32-bit counter called COUNT. Every ciphering and every integrity computation consumes it, and the entire security guarantee rests on one rule: a given COUNT value must never be reused with the same key on the same bearer in the same direction. Break that rule and the mathematics falls apart.

COUNT (32 bits) = HFN (Hyper Frame Number, upper bits) ‖ PDCP SN (Sequence Number, lower bits)

The lower bits of COUNT are the PDCP SN that actually travels in each PDU header. Because the SN field is short (5, 7, 12, 15, or 18 bits depending on bearer type and configuration), it wraps around quickly — a 12-bit SN, for example, repeats every 4096 packets. The upper bits are the HFN, whose width is 32 minus the SN length (so 20 bits for a 12-bit SN, 27 bits for a 5-bit SN) — a counter that both sides keep locally and increment by one every time the PDCP SN rolls over from all-ones back to zero. The HFN is never transmitted; each side infers it from watching the SN wrap. Concatenated, HFN and SN form a value that climbs monotonically across the whole life of the bearer, giving every single PDU a unique COUNT.

Why does reuse destroy security? A stream cipher produces ciphertext as plaintext XOR keystream, and the keystream is a deterministic function of (key, COUNT, BEARER, DIRECTION). If two different plaintexts are ever enciphered with the same keystream, an attacker who XORs the two ciphertexts cancels the keystream entirely and is left with the XOR of the two plaintexts — often enough to recover both. So COUNT is not a nicety; it is the safety interlock that keeps each keystream one-time. This is also precisely why LTE mandates a key change / key refresh before COUNT can wrap all the way around: when the PDCP COUNT is about to exhaust, the eNB triggers an intra-cell handover or key re-keying so a fresh KeNB resets the counters.

32-bit COUNT = HFN (upper) ‖ PDCP SN (lower) HFN (Hyper Frame Number) local, never transmitted; ++ on SN wrap PDCP SN carried in PDU header bit 31 (MSB) bit 0 (LSB) COUNT (32) BEARER (5) DIRECTION (1) KEY (128) LENGTH EEA / EIA engine SNOW 3G / AES / ZUC keystream XOR payload (EEA) MAC-I (32 bit) integrity tag (EIA)
Figure 1. Top: the 32-bit COUNT is HFN (upper bits, kept locally) concatenated with the PDCP SN (lower bits, carried in the header). Bottom: COUNT, BEARER, DIRECTION, KEY and LENGTH feed the EEA/EIA engine, which yields either a keystream (ciphering) or a 32-bit MAC-I (integrity).

The Five Inputs and the 32-bit MAC-I

Both EEA and EIA are functions of the same handful of inputs. Getting them exactly right is the whole game — the inputs are what guarantee keystream uniqueness for ciphering and message binding for integrity. TS 33.401 fixes them as follows.

InputSizeEEA (cipher)EIA (integrity)Purpose
COUNT32 bitsYesYesPer-PDU freshness (HFNSN); prevents keystream reuse and detects replay
BEARER5 bitsYesYesRadio-bearer identity so two bearers with the same key/COUNT still differ
DIRECTION1 bitYesYes0 = uplink, 1 = downlink, so UL and DL never collide on the same COUNT
KEY128 bitsKRRCenc / KUPencKRRCintThe confidentiality or integrity key derived from KeNB
LENGTH / MESSAGEvariesLENGTH of keystream neededMESSAGE to protectCipher needs a keystream length; integrity needs the actual message bits

For ciphering, the EEA takes KEY, COUNT, BEARER, DIRECTION, and a LENGTH telling it how many keystream bits to produce, and outputs a keystream block of exactly that length. For integrity, the EIA takes KEY, COUNT, BEARER, DIRECTION, and the MESSAGE itself (header plus data), and outputs a fixed 32-bit tag. That tag is the MAC-I — the Message Authentication Code for Integrity. It is always 32 bits regardless of message length, and it is appended to the PDCP Data PDU on SRBs.

On reception the receiver runs the identical EIA over the received message with its own copy of the key and inputs, producing a value called XMAC-I (the expected MAC-I). If XMAC-I equals the received MAC-I, the message is authentic and unmodified and is accepted; if they differ — even by one bit — the PDU has been tampered with or corrupted, and PDCP discards it and reports an integrity failure to RRC.

🎯

Why so many inputs? A stream cipher is only safe if every keystream is one-time. COUNT makes it unique over time, BEARER over radio bearers, and DIRECTION over uplink vs downlink. The same three, bound into the integrity tag, also stop an attacker from replaying a valid old message or splicing a downlink message into the uplink.

How the Engine Runs: Keystream vs MAC-I

Ciphering and integrity are the same shape — pour the inputs plus the key into the algorithm and take the output — but what you do with the output differs completely.

Ciphering. The chosen EEA (say EEA2) uses KEY, COUNT, BEARER, DIRECTION and LENGTH to generate a pseudo-random keystream block the same length as the payload. The sender computes ciphertext = plaintext XOR keystream. The receiver regenerates the identical keystream (it holds every input independently) and computes plaintext = ciphertext XOR keystream. Because XOR is its own inverse, the exact same operation both enciphers and deciphers — there is no separate decrypt algorithm. Only the data part of the PDCP PDU is ciphered; the PDCP header is not, because the receiver needs the PDCP SN in clear to reconstruct COUNT before it can decipher anything.

Integrity. The chosen EIA (say EIA2) takes KEY, COUNT, BEARER, DIRECTION and the whole MESSAGE (the PDCP header plus the data), and produces the 32-bit MAC-I, which is appended to the PDU. Crucially the header is covered by integrity even though it is not ciphered, so an attacker cannot rewrite the SN without breaking the tag.

The order of operations inside PDCP matters and is fixed by TS 36.323. On transmit, integrity is applied first (compute MAC-I over header + data), then ciphering is applied over the data part (and, on SRB, over the appended MAC-I). On receive the order is reversed: decipher first, then verify MAC-I. That way the integrity check always runs over exactly the plaintext the sender protected. Informally: on the way out, integrity-then-cipher; on the way in, decipher-then-check.

The AS Keys — KRRCenc, KRRCint, KUPenc

LTE never uses one key for everything. The Access-Stratum keys all descend from KeNB, the base-station key that the eNB and the UE both hold after authentication. From KeNB, three keys are derived by a Key Derivation Function (an HMAC-SHA-256 construction), each with exactly one job — and, importantly, the identity of the selected algorithm is mixed into the derivation, so a key is cryptographically bound to the one algorithm it is used with.

KeyDerived fromProtectsUsed byFunction
KRRCencKeNB + EEA idSRB (RRC)EEACiphering of RRC signalling
KRRCintKeNB + EIA idSRB (RRC)EIAIntegrity protection of RRC signalling
KUPencKeNB + EEA idDRB (user plane)EEACiphering of user data

Notice what is missing: there is no KUPint in the classic LTE set, precisely because user-plane integrity is not used. All three keys trace back to KeNB, which itself sits inside the wider EPS key hierarchy: the master key K in the USIM and the HSS/AuC produces CK/IK during authentication; those yield KASME at the MME; KASME plus an uplink NAS COUNT yields KeNB; and KeNB yields the three AS keys above. When KeNB changes — at handover (via a horizontal or vertical key derivation using the NH/NCC chain) or on a re-key — all three AS keys are refreshed with it and the PDCP COUNTs reset.

🎯

One root, three leaves: KeNB → { KRRCenc, KRRCint, KUPenc }. Because the algorithm id is folded into each derivation, changing the selected EEA/EIA changes the key — you cannot mismatch a key with an algorithm. For the full chain from the USIM down, see the EPS key hierarchy topic linked below.

Activation, Replay Protection and MAC-I Failure

Security is not on from the first message. The earliest RRC messages (up to and including the RRCConnectionSetup and the initial NAS exchange) travel unprotected because no KeNB yet exists. Protection is switched on explicitly by the AS Security Mode Command procedure, run by RRC once authentication has produced KeNB and the eNB has chosen an EEA and an EIA.

The eNB sends SecurityModeCommand, which carries the selected cipheringAlgorithm and integrityProtAlgorithm. This message is a special hinge: it is integrity-protected but not yet ciphered. The UE verifies its MAC-I using the freshly derived KRRCint; if the check passes, the UE knows the network holds the same key, activates both integrity and ciphering, and replies with a SecurityModeComplete that is itself integrity-protected and ciphered. From that point on, all RRC signalling is ciphered and integrity-protected, and once DRBs are set up their user data is ciphered. If the UE cannot verify the command's MAC-I, it responds with SecurityModeFailure and keeps the old (unprotected) configuration.

Replay protection is a direct consequence of COUNT. Because the integrity tag is computed over the message together with the ever-increasing COUNT, an attacker who captures a valid PDCP PDU and re-injects it later cannot make it verify: the receiver has already advanced its COUNT past that value, so recomputing XMAC-I at the current COUNT yields a different tag, and the stale COUNT is recognised as out-of-window. A replayed packet therefore fails the integrity check or is discarded as a duplicate.

MAC-I failure is treated as a security event, not a mere transmission error. When PDCP integrity verification fails on an SRB, the PDU is discarded and the failure is indicated to RRC, which may trigger re-establishment or connection release. Persistent integrity failures are a signal of tampering or a man-in-the-middle attempt, so the stack fails closed rather than passing the suspect message up.

⚠ Common pitfalls / gotchas

  • Assuming DRBs are integrity-protected in classic LTE. They are not — user data is ciphered only, which is why there is no KUPint. Reasoning as if a tampered user packet would be caught will mislead you (NR added optional UP-IP; LTE did not).
  • Forgetting the header is authenticated but not ciphered. The PDCP SN rides in the clear so COUNT can be rebuilt, yet it is covered by the MAC-I — so it cannot be silently rewritten, even though it is readable.
  • Confusing EEA2 and EIA2. Both are AES, but one runs CTR mode to make a keystream (confidentiality) and the other CMAC mode to make a tag (integrity). "AES" alone does not tell you which job is being done.
  • Letting COUNT wrap. Reusing a COUNT under the same key/bearer/direction breaks the cipher outright. The network must re-key (intra-cell HO or fresh KeNB) before wrap — not treat it as a rare edge case.

Summary

LTE access-stratum security lives in PDCP (TS 36.323, TS 33.401) as two independent transforms: ciphering for confidentiality on both SRB and DRB, and integrity protection for authenticity and replay defence on SRB only — which is why the classic AS key set is KRRCenc, KRRCint, KUPenc with no KUPint. The algorithm families are EEA (encryption) and EIA (integrity), each a 4-bit-identified member built on the null algorithm, SNOW 3G, AES or ZUC, all with 128-bit keys. Both engines consume five inputs — the 128-bit KEY, the 32-bit COUNT = HFN ‖ SN, a 5-bit BEARER, a 1-bit DIRECTION, and either a keystream LENGTH (cipher) or the MESSAGE (integrity) — producing either a keystream that is XORed onto the payload or a fixed 32-bit MAC-I. The one unbreakable rule is that COUNT must never repeat under a key, which forces a re-key before wrap. Security is switched on by the AS SecurityModeCommand (integrity-protected but not yet ciphered), and any MAC-I mismatch is treated as a security event, not a transmission glitch.

Q&A Interview quickfire

Q. Which bearers get ciphering, and which get integrity protection, in classic LTE?

A. Ciphering applies to both SRB and DRB. Integrity protection applies to SRB only — classic LTE has no user-plane integrity, which is why the AS key set has KRRCenc, KRRCint and KUPenc but no KUPint. NR later added configurable per-DRB integrity.

Q. What is COUNT made of, and why must it never repeat under one key?

A. COUNT = HFN (upper bits, kept locally) concatenated with the PDCP SN (lower bits, in the header). If the same COUNT were reused with the same key, bearer and direction, two packets would share a keystream; XORing their ciphertexts cancels the keystream and leaks the plaintexts. So a re-key is forced before COUNT can wrap.

Q. What are the inputs to the EEA/EIA functions, and how big is the MAC-I?

A. COUNT (32b), BEARER (5b), DIRECTION (1b), the 128-bit KEY, and a LENGTH (cipher) or the MESSAGE (integrity). The integrity output, MAC-I, is always 32 bits.

Q. What is the difference between EEA2 and EIA2 if both are AES?

A. Both use AES, but EEA2 runs it in counter mode to make a keystream that is XORed onto the payload (confidentiality), while EIA2 runs it in CMAC mode to make the 32-bit MAC-I (integrity). Same primitive, different construction.

Q. How is security switched on, and what protects the command itself?

A. The AS SecurityModeCommand carries the chosen EEA/EIA. It is integrity-protected with KRRCint but not yet ciphered; the UE verifies its MAC-I, then activates ciphering and integrity and replies with a ciphered, integrity-protected SecurityModeComplete. A bad MAC-I yields SecurityModeFailure.

Q. How does replay protection fall out of this design?

A. The MAC-I is computed over the message plus the monotonically increasing COUNT. A replayed old PDU carries a stale COUNT; at the receiver's advanced COUNT the recomputed XMAC-I no longer matches, and the stale value is outside the accepted window, so the PDU fails or is dropped as a duplicate.

Where PDCP security connects

Ciphering and integrity are one link in a longer chain: the keys are born in the EPS key hierarchy, switched on by the AS Security Mode procedure, and carried out by PDCP alongside its header, sequencing and reordering duties. From here, follow the keys up to their root or the activation down into the call flow.

EPS Security Key Hierarchy — where KeNB and the AS keys come fromAS Security Mode Command — how ciphering and integrity are activatedPDCP Overview — the layer that carries out these functions