HomeISO mDOCDocument Structure

mDOC Document Structure

Understanding the hierarchical structure of an mDOC, including namespaces, data elements, and the issuerSigned/deviceSigned components.

Structure Overview

An mDOC contains two main signed components: issuerSigned (data from the issuer) and deviceSigned (proof from the holder's device during presentation).

docType

Identifies the document type. For mDL: 'org.iso.18013.5.1.mDL'

issuerSigned

Contains namespaces with signed data elements and the MSO (issuer's signature).

deviceSigned

Added during presentation. Contains device authentication proving holder possession.

nameSpaces

Organizes data elements by namespace (standard, jurisdiction-specific, custom).

Namespaces

Namespaces group related data elements and allow for standardized as well as custom extensions. Each namespace contains an array of IssuerSignedItems.

org.iso.18013.5.1Standard mDL Namespace

Contains the core mDL data elements defined by ISO 18013-5: name, birth date, portrait, driving privileges, age attestations, etc.

org.iso.18013.5.1.aamvaAAMVA (US) Namespace

US-specific extensions for domestic driving privileges, name suffixes, organ donor status, veteran indicator, etc.

CustomCustom Namespaces

Issuers can define custom namespaces for additional data. Should use reverse domain notation (e.g., "com.example.myapp").

Standard mDL Data Elements

The org.iso.18013.5.1 namespace defines these standard data elements. Only a subset is required; most are optional.

ElementTypeDescription
family_nametstrLast name / surname
given_nametstrFirst name
birth_datefull-dateDate of birth (tag 1004)
issue_datefull-dateDate credential was issued
expiry_datefull-dateDate credential expires
issuing_countrytstrISO 3166-1 alpha-2 country code
issuing_authoritytstrName of issuing authority
document_numbertstrLicense number
portraitbstrPhoto (JPEG or JPEG2000)
driving_privilegesarrayArray of vehicle categories
age_over_18boolIs holder 18 or older?
age_over_21boolIs holder 21 or older?
Age Attestations
Elements like age_over_18 and age_over_21 allow age verification without revealing exact birth date - a privacy-preserving feature.

IssuerSignedItem

Each data element is wrapped in an IssuerSignedItem structure that includes a random salt for privacy and a digestID that links to the MSO.

IssuerSignedItem Structure
IssuerSignedItem = {
  "digestID": 0,           // uint - index in MSO digest array
  "random": h'...',        // bstr - salt for privacy
  "elementIdentifier": "given_name",  // tstr
  "elementValue": "Alice"  // any CBOR value
}

// The hash of this item appears in the MSO
// Hash = SHA-256(CBOR(IssuerSignedItem))

digestID

Index into the MSO's valueDigests array. Links this item to its hash in the signed MSO.

random

Random bytes (salt) that make each hash unique, enabling selective disclosure without revealing other elements.

elementIdentifier

The name of the data element (e.g., "given_name", "birth_date").

elementValue

The actual value. Can be any CBOR data type (string, int, date, bytes, etc.).

Selective Disclosure via Salted Hashes

The MSO contains only the hashes of IssuerSignedItems. During presentation, the holder includes only the items they want to disclose. The verifier:

  1. 1. Receives IssuerSignedItems from holder
  2. 2. Computes hash of each IssuerSignedItem
  3. 3. Looks up digestID in MSO's valueDigests
  4. 4. Confirms computed hash matches MSO hash

DeviceResponse Structure

When presenting an mDOC, the wallet creates a DeviceResponse containing the selected elements from issuerSigned plus deviceSigned authentication.

DeviceResponse (Presentation)
DeviceResponse = {
  "version": "1.0",
  "documents": [
    {
      "docType": "org.iso.18013.5.1.mDL",
      "issuerSigned": {
        "nameSpaces": {
          "org.iso.18013.5.1": [
            // IssuerSignedItem for each disclosed claim
            24(<< IssuerSignedItem >>),
            24(<< IssuerSignedItem >>),
            ...
          ]
        },
        "issuerAuth": // COSE_Sign1 containing MSO
      },
      "deviceSigned": {
        "nameSpaces": 24(<< {} >>),  // Optional device-added claims
        "deviceAuth": {
          "deviceSignature": // COSE_Sign1 or
          "deviceMac": // COSE_Mac0
        }
      },
      "errors": null  // Optional error codes
    }
  ],
  "status": 0  // 0 = OK
}
Holder Controls Disclosure
The holder selects which IssuerSignedItems to include in the response. Omitted items remain private - the verifier only sees their hashes in the MSO.
Device Authentication Required
The deviceSigned section proves the holder controls the device key. Without this, a copied credential could be used by anyone.