InnerWeb
Skip to main content

How mutual authentication between card and reader works

Mutual authentication means that not only the reader checks the card, but the card also checks the reader before it reveals anything. This guide explains the course of the conversation step by step, shows why eavesdropping alone does not allow the card to be cloned, and points out what follows for security, IT and purchasing.

128 bit
AES key length
8 bytes
CMAC length

Why mutual authentication at all

With simple cards, the reader asks for a number, the card answers, and the conversation ends. Anyone who eavesdrops on or copies the answer can replay it. In encrypted cards the conversation starts with proof: both sides must show that they know the same key, but neither sends the key in plain text.

In DESFire EV3, encryption is done by a hardware AES module with 128-bit keys, and the key has a version number. This key is the shared secret on which the whole exchange rests.

The course of the conversation step by step

Below is a simplified description, without byte-level detail, which is enough to understand the principle and to discuss it with a vendor.

  • The reader selects the application on the card and asks to start authentication with a specific key.
  • The card generates a random number, encrypts it with the key and sends it to the reader.
  • The reader decrypts it, generates its own random number, and sends both back, mixed and encrypted.
  • The card checks that the response contains its number. Only the holder of the key could process it correctly, so the card knows the reader is genuine.
  • Both sides derive from the exchanged numbers a session key, valid only for this one conversation.
  • The data in the session is protected by an 8-byte CMAC code, which confirms the authenticity of every message.

Steps of the conversation between card and reader

Steps of the conversation between card and readerBar chart numbering the six steps of the conversation between card and reader0246stepApplication selection: 1 step1 stepApplicationselectionCard challenge: 2 step2 stepCard challengeReader response: 3 step3 stepReaderresponseCard verification: 4 step4 stepCardverificationSession key: 5 step5 stepSession keyData with CMAC: 6 step6 stepData with CMAC
Source: Simplified description of the authentication course, step numbering from this guide

Why eavesdropping is not enough to clone the card

An eavesdropper sees only random numbers encrypted with the key and CMAC codes. Without the key, they cannot decrypt the exchange. They also cannot replay it, because at the next attempt the reader sends a different random number, and the old answer will not match.

Cloning would require extracting the key from the card, and the key does not leave the chip. That is why the real threats concern key management: one key shared by all cards, a key written in project documents, or a factory default key that nobody replaced.

The role of key diversification

In secure card ecosystems, key diversification relies, among other things, on a key derivation function according to NIST SP 800-108. Each card then has a key derived from the master key and its own UID, so disclosing the key of one card does not open the others.

This matters for risk assessment: someone who, with considerable effort, extracts the key of one card does not get the key of the whole workforce. The vendor should describe where the master key is kept and who has access to it.

Relay attacks and proximity checking

Mutual authentication does not solve the relay attack, in which two devices pass the conversation between the card and a distant reader. That is why DESFire EV3 offers proximity checking: the reader measures the response time and rejects the session when the delay suggests an intermediary.

The function must be enabled in the configuration. It is worth writing into the purchasing specification whether the readers support it, and checking it on a test bench.

What follows for the access system and InnerWeb

An encrypted card does not replace the access decision: it verifies the identity of the medium, while the permissions on the system side decide entry. InnerWeb is a software vendor and does not take part in card authentication. We receive punch events from the access control system and link them with qualifications, permits and attendance.

For an audit this means a clear division of responsibility: protection of keys and authentication lie with the access system, while proof of entry and permissions lie with the supplementary platform.

Video

Frequently asked questions

Does an eavesdropped conversation allow entry with someone else's card?

No. The eavesdropper does not know the key, and at the next attempt the reader sends a different random number, so the recorded answer does not match.

Is proximity checking always enabled?

The chip offers it, but its use depends on the configuration of the card and the reader. It is worth writing it into the specification.

Does InnerWeb take part in card authentication?

No. We receive punch events from the access control system and link them with permissions.

Sources

Ask us about integrating access events

We will explain how events from your access control system feed permissions and attendance in InnerWeb. Book a conversation with our team.

Let's talk