Mobile driving licenses and mdoc
At a shop counter, Riley proves they are over 21 with the driving license on their phone, without showing their birth date. This lesson explains the mdoc format behind mobile driving licenses, the two separate checks a reader makes, what an offline reader cannot know, and why a convincing picture of a license is not evidence.
A document format with a presentation protocol
The Northwind project launch is on Friday, and Riley stops at a wine shop on the way. At the counter, the cashier asks for ID. Riley's driving license is on their phone, and the shop has a small reader beside the register. They hold their phone near it, their walletAn application that holds a person's verifiable credentials and the keys that go with them, receives credentials from issuers, and presents them to verifiers when the person agrees. asks whether to share one fact, that they are over 21, and they approve. The reader shows a green check mark.
The cashier could have looked at a picture of a license on Riley's screen, but a picture proves nothing. Anyone can edit a screenshot, and an animation that looks live can be recorded. What the reader needs is data signed by the authority that issued the license, together with proof that the phone in front of it is taking part in this exchange now.
A mobile driving license (mDL) provides both. Most mDLs follow the international standard ISO/IEC 18013-5, which defines a document format called mdoc and the protocolAn agreed set of rules for the messages two systems exchange and what each message means. HTTP, OAuth 2.0, OpenID Connect and SAML are all protocols. for presenting it in person. An mdoc is not a JWTA JSON Web Token: a compact token made of Base64url-encoded parts that carries claims and is usually signed. Anyone holding it can decode and read the claims, so the signature shows who issued it but hides nothing. with a different label. It is encoded in CBOR, a compact binary cousin of JSONA text format for structured information, written as named values inside curly braces. APIs, tokens, and discovery documents all use it., and protected with COSE, the CBOR counterpart of the JOSE signatures used by JWTs. Its contents are organized by document type, namespace and data element, so the same name always means the same thing: age_over_21 in the mDL namespace is a defined element, not a label a reader has to interpret. What actually crosses from the phone to the reader is a DeviceResponse, a CBOR structure holding the issuer-signed elements and the device's own proof; the decoded record below is one document from inside it.
Document type: org.iso.18013.5.1.mDL
Namespace: org.iso.18013.5.1
Issuer-signed data elements (each stored with a digest ID and a random value)
0 given_name "Riley"
1 birth_date 1996-03-14
2 document_number "D0482-1196"
3 portrait (image)
4 age_over_18 true
5 age_over_21 true
Mobile Security Object (MSO)
digestAlgorithm: SHA-256
valueDigests: org.iso.18013.5.1 -> { 0: <SHA-256 of element 0>, ... 5: <SHA-256 of element 5> }
deviceKeyInfo: public key of a key pair generated and kept on Riley's phone
docType: org.iso.18013.5.1.mDL
validityInfo: signed 2026-10-01, validFrom 2026-10-01, validUntil 2026-12-30
MSO signature: COSE_Sign1 by the issuing authority's document signer certificateThe Mobile Security Object (MSO) is the part the issuing authority signs. It does not contain Riley's data. It contains a digest of each data element, a validity period, and the public half of a key that lives on Riley's phone. Each element is stored with a random value before it is hashed, which will be familiar from Selective disclosure with SD-JWT: the phone can send any subset of elements, the reader can check each one it receives against the signed digests, and the digests of the rest reveal nothing.
That is how Riley shared only one fact. The issuing authority computed age_over_18 and age_over_21 when it issued the license, so the reader could ask for the threshold the shop needs and never see the birth date, the document number or the address. A reader can only ask for thresholds the issuer chose to include, and a shop that also needed to compare the person at the counter with the license holder would ask for the portrait as well: a second element, with its own purpose.
Check issuer data and device presentation separately
The reader makes two checks that answer different questions, and passing one never stands in for the other.
Issuer data authentication asks whether the license data is genuine and unchanged. The MSO arrives with the issuing authority's document signer certificate, which the reader validates up to the issuing authority's root certificate, as Validating a certificate describes. That root must already be in the reader's list of trusted issuing authorities; a certificate chain that arrives in the response cannot add a new authority to the list. The reader then checks the MSO signatureA value made with a private key that lets anyone holding the matching public key check that a message came from the key's holder and has not been changed. It proves origin and integrity; it does not hide the message. and its validity period, hashes the age_over_21 element it received, and compares the result with digest 5.
All of that could be satisfied by a recording. If someone captured the data Riley's phone sent at a different counter last week, the issuer data would still be genuine. Device authentication asks the second question: is the phone holding this license taking part in this exchange? When the phone and reader connect, the phone shares its engagement data, the DeviceEngagement, by QR code or NFC, and the reader generates a fresh key for the session. Those values and the details of the handover make up the session transcript, which both sides compute and which is different every time. The phone then proves it holds the device key whose public half is in the MSO, either by signing the transcript with it or by computing a message authentication code (MAC) over the transcript with a key derived from the device key and the reader's session key.
| Aspect | Issuer data authentication | Device authentication |
|---|---|---|
| Question | Is this the data the issuing authority signed? | Is the phone holding the license taking part in this session? |
| Covers | The MSO, and through its digests each released element | The current session transcript and the document type |
| Key | The document signer certificate, trusted through the issuing authority's root | The device key whose public half is in the MSO |
| Fails when | The authority is not trusted, an element was changed, or the MSO has expired | The proof is missing, made with another key, or made for another session transcript |
Now suppose a reader passes the issuer check and skips the device check when the proof does not match. A response recorded at another counter, with a device proof made for that session's transcript, would sail through: genuine data, a genuine device signature, and the wrong session. The reader computes its own transcript for the current session and refuses any device proof made over a different one.
The two checks together still leave questions open. They show that a genuine license was presented from the phone it was issued to. They do not show that the shop is allowed to rely on an mDL for an alcohol sale, which depends on the law where the shop is, and they do not make the reader trustworthy with what it receives. Releasing one element limits what the shop learns; what the shop then keeps is up to the shop.
Offline presentation has explicit limits
The reader at the wine shop never contacted the issuing authority. The phone and reader found each other by NFC, the short-range radio phones use for tap-to-pay, exchanged data over a short-range connection, and the reader checked everything with what it already had. That works in a basement shop with no signal, and it means the issuing authority does not learn where Riley showed their license. It also means the reader knows only what it knew before Riley walked in.
| Question | What the reader has | What it cannot know offline |
|---|---|---|
| Which issuing authorities to trust | The trust list from its last update, three days ago | An authority removed from the list since then |
| Whether the license data is current | The MSO's validity period, ending 2026-12-30 | A suspension decided after the MSO was signed |
| Whether this phone is presenting now | The session transcript and device proof | Nothing missing: this check works fully offline |
Issuing authorities narrow the gap by signing MSOs for weeks or months rather than for the license's whole life, and by having the wallet fetch a fresh MSO when it has a connection. A license suspended today can then be presented offline only until its current MSO expires. The reader needs its own policy for the rest: how old its trust list may be, and what to do when the MSO is close to expiry or the reader has been offline too long. When a check could not be made, the reader should say so rather than show the same green check mark. The cashier can then ask for another form of ID.
Trust also runs the other way. The reader can authenticate itself to the wallet with a reader certificate, so Riley's wallet can show which organization is asking before they approve. A wallet that cannot identify the reader can still show exactly which elements are requested.
The same mdoc can also be presented online, to a website rather than a shop counter, and a separate standard governs that case: ISO/IEC 18013-7, which profiles online mDL presentation. It builds on the OpenID4VP flow from Presenting from a wallet, carrying the mdoc with the format identifier mso_mdoc in place of the SD-JWTA signed JWT whose claims are replaced by digests, with each claim's value kept in a separate disclosure. The holder sends only the disclosures it chooses, so a verifier sees just the claims it needs. format, and it also profiles the browser's Digital Credentials API, through which a web page asks the operating system for a credential and the wallet answers. That browser-mediated path changes the session binding: the reader's identity the device proof covers is the requesting web origin, which is what makes the request hard to relay to a different site. The format, the standard and the transport are separate choices, and a reader or wallet that supports one combination does not necessarily support another.
Inspect real evidence, not a convincing picture
The green check mark at the wine shop means something only because the reader checked evidence it could verify. A screenshot of a license, however convincing, contains no signature the reader can check and no proof tied to this session. The decoded record above is no better as evidence: it shows the structure, but no CBOR was parsed and no COSE signature was verified to produce it.
When the evidence is wrong, the reader should say how. A license from an authority missing from its trust list, an element changed after signing, an MSO past its validUntil date and a device signature made for another session transcript are four different refusals, and a cashier who sees which one it was knows whether to ask for a plastic card or to stop the sale. Whether the shop may lawfully accept a phone's answer at all is a separate question for the jurisdiction, and no cryptographic check settles it.
Check your understanding
Try these questions before moving on. If an answer isn't right, use the feedback and try again.
Try it in the Lab
- Decode an mdoc DeviceResponse and verify its issuer and device signaturesParse a mobile driving license DeviceResponse with a small CBOR decoder, check the MSO signature, digest, validity and device signature, then see a changed element, an unsigned digest ID and a replayed session refused.