| Internet-Draft | MDA/1 | November 2026 |
| Johnson | Expires 27 May 2027 | [Page] |
This document specifies the Flat Data Artifact Format Version 1 (MDA/1), a fixed-layout, zero-copy binary container for exchanging and storing signed data artifacts in resource-constrained, intermittently connected, and offline environments. MDA/1 artifacts have one canonical encoding and a stable content identifier, can be parsed without dynamic memory allocation, and are validated by a strictly ordered pipeline whose limits are enforced from a 64-byte header. Every byte except the signature values is covered by Ed25519, ML-DSA-44, or hybrid signatures, and signers are bound to the principals they speak for. The document also defines VB01, a key-committing, length-bucketed AEAD frame for payloads at rest, and an HPKE profile, including the X-Wing post-quantum KEM, for delivering frame keys. MDA/1 is intended as a compact edge transport and storage envelope alongside HL7 FHIR.¶
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.¶
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."¶
This Internet-Draft will expire on 27 May 2027.¶
Copyright (c) 2026 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.¶
This document defines MDA/1, a single flat, fixed-layout binary container for data artifacts that edge systems exchange or store: control messages (request, consent, grant, receipt, revocation, error), asset metadata, append-only log records, provenance commitments, ledger anchor receipts, snapshots, emergency profiles, break-glass audit receipts, trust bundles, and DID document envelopes. It also defines VB01, a length-hiding encrypted frame for asset payloads at rest, and the HPKE key-wrapping profile used to deliver frame keys.¶
The target environment is low-end mobile hardware, intermittent power and connectivity, offline verification, and parsers that fit in a few kilobytes of compiled code and run without dynamic memory allocation.¶
MDA/1 does not replace HL7 FHIR [FHIR]. It is an offline-first binary transport and edge-storage envelope used alongside FHIR systems. Gateways convert between FHIR resources and MDA/1 artifacts at the boundary between a connected FHIR server and disconnected edge devices.¶
The conversion is a lossy profile, not an isomorphism. Only the elements listed below are carried. A gateway MUST reject, rather than silently truncate, a FHIR resource whose meaning depends on elements that the profile cannot carry. Examples are nested or "deny" Consent provisions, and Composition sections outside the list below. A resource reconstituted from MDA/1 MUST be marked as derived (for example, with a meta.tag) and MUST NOT be presented as the original resource.¶
| FHIR R4 resource | MDA/1 artifact | Elements carried |
|---|---|---|
| Consent | CONSENT (0x02) | patient, one permit provision: actor, purpose, period, data (as scopes) |
| Composition (IPS) | EMERGENCY_PROFILE (0x20) | allergies, meds, problems, contacts, advance directive |
| AuditEvent | EMERGENCY_ACCESS_RECEIPT (0x21) | agent, entity, recorded, source |
| Provenance | PROVENANCE_COMMITMENT (0x12) | target, agent, recorded |
| DocumentReference + | ASSET_MANIFEST (0x10) | identifier, type, |
| Binary | + VB01 frame | date, content |
The EMERGENCY_PROFILE row follows the International Patient Summary [IPS]. Coded concepts are carried as two strings: a code and a code-system URI. Text longer than 256 bytes (for example, medication instructions) is carried in the record text span (Section 7.2).¶
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.¶
| Rule | Statement |
|---|---|
| C-1 | All multi-byte integers are little-endian. |
| C-2 | Timestamps (ts) are unsigned milliseconds since the Unix epoch, UTC. Durations named *Sec are seconds. The value 0 means "unbounded" only where a field definition says so. |
| C-3 | Reserved fields, reserved flag bits, and all padding MUST be zero on emission. Receivers MUST reject non-zero values unless Section 17 permits them. |
| C-4 | Every section starts at an offset that is a multiple of 16 and has a length that is a multiple of 16. No bytes follow the signature value section. |
| C-5 | Absent str_ref = 0xFFFFFFFF; absent span = {0, 0}; absent OPTIONAL hash32 or raw16 = all zero bytes. |
| C-6 | The string table is sorted, unique, fully referenced, and well-formed UTF-8 (Section 5). |
| C-7 | Records appear in canonical order (Section 7.1). |
| C-8 | Signature entries and values appear in canonical order (Section 8). |
| C-9 | Blob items appear in canonical layout (Section 6.2). |
| C-10 | The CRC-32 is verified before any byte outside the header is interpreted (Section 15.1). |
| C-11 | Size bounds (Section 14) are enforced from the header before any input-dependent memory allocation. |
| C-12 | Offset and length arithmetic MUST NOT wrap: it uses at least 64-bit unsigned integers or checked arithmetic. |
Rules C-3 through C-9 make the encoding canonical. For a given logical artifact, meaning a given value for every field, including identifiers, nonces, and timestamps, the bytes from offset 0 to sigValOff are uniquely determined. Encoders MUST normalize every string to Unicode Normalization Form C [UAX15] before encoding. Receivers are not required to check NFC, because doing so needs Unicode tables that a minimal parser cannot carry; Section 19.6 explains why this does not create malleability.¶
Signature values (Section 8.2) and VB01 frames (Section 9) may be randomized. Neither contributes to the ArtifactID, so the ArtifactID stays stable.¶
| Name | Size | Definition |
|---|---|---|
| u8 | 1 | Unsigned 8-bit integer |
| u16 | 2 | Unsigned 16-bit integer, little-endian |
| u32 | 4 | Unsigned 32-bit integer, little-endian |
| u64 | 8 | Unsigned 64-bit integer, little-endian |
| i32 | 4 | Two's-complement signed 32-bit, little-endian |
| ts | 8 | u64 milliseconds since Unix epoch, UTC |
| enum8 | 1 | Enumerated value (Section 13) |
| raw16 | 16 | Identifier or nonce: 128 bits from a CSPRNG |
| hash32 | 32 | SHA-256 digest [FIPS180-4] |
| str_ref | 4 | u32 absolute offset of a string table entry, or 0xFFFFFFFF (absent) |
| span | 8 | {u32 off, u32 len}: absolute offset and length of a Blob item, or {0, 0} (absent) |
| bytes | n | Opaque octets |
Every identifier and nonce field is a raw16 generated by a cryptographically secure random number generator. Encoders MUST NOT derive identifiers from counters, timestamps, or personal data. Where text is needed, an identifier is written as 32 lowercase hexadecimal characters ("canonical ID text").¶
Every artifact is a sequence of seven contiguous, non-overlapping sections, in this fixed order:¶
0 64 recOff sigOff strOff blobOff sigValOff +------+----------+----------+----------+--------+--------+--------+ |Header| Body | Records |Signature | String | Blob |Sig | | 64 B | bodyLen |rc * rs | entries | table | |values | | | | | sc * 32 | strLen | blobLen|sigValLn| +------+----------+----------+----------+--------+--------+--------+ |<-------------- ArtifactID and signature coverage ------>| |<-------------------------- CRC-32 coverage ---------------------->|
Signature values come last, so every signature covers every other section, the signature entries included (Section 8.4).¶
| Off | Size | Field | Type | Notes |
|---|---|---|---|---|
| 0 | 4 | magic | bytes | ASCII "MDA1" (4D 44 41 31) |
| 4 | 1 | major | u8 | Major version; this spec = 1 |
| 5 | 1 | minor | u8 | Minor version; this spec = 0 |
| 6 | 1 | type | u8 | Artifact type (Section 11) |
| 7 | 1 | (rsv) | u8 | Reserved |
| 8 | 2 | flags | u16 | Header flags (Section 4.3) |
| 10 | 2 | strCount | u16 | Number of string entries |
| 12 | 4 | totalLen | u32 | Artifact size in bytes |
| 16 | 4 | bodyLen | u32 | MUST equal type body size |
| 20 | 2 | recCount | u16 | Number of records |
| 22 | 2 | recStride | u16 | Record stride, 0 if none |
| 24 | 2 | sigCount | u16 | Number of signature entries |
| 26 | 2 | sigStride | u16 | 32 if sigCount > 0, else 0 |
| 28 | 4 | strOff | u32 | String table offset |
| 32 | 4 | strLen | u32 | String table length |
| 36 | 4 | blobOff | u32 | Blob section offset |
| 40 | 4 | blobLen | u32 | Blob section length |
| 44 | 4 | sigValOff | u32 | Signature value offset |
| 48 | 4 | sigValLen | u32 | Signature value length |
| 52 | 4 | crc32 | u32 | CRC-32 (Section 4.5) |
| 56 | 8 | (rsv) | bytes | Reserved |
| Bit | Name | Meaning |
|---|---|---|
| 0 | FLAG_SIGNED | MUST be 1 if sigCount > 0, else 0. |
| 1..7 | (non-critical) | Reserved for minor-version extensions that receivers may ignore. |
| 8..15 | (critical) | Reserved for extensions that change how the artifact must be processed. |
FLAG_SIGNED only describes the artifact's structure. Whether an artifact must be signed is decided by its type (Section 8.6), never by this flag. In minor version 0, every bit except bit 0 MUST be zero. A receiver MUST reject an artifact that sets a critical bit it does not implement (UNKNOWN_CRITICAL_FLAG), whatever the artifact's minor version.¶
Receivers derive every section offset from lengths, using arithmetic that cannot overflow (C-12):¶
recOff = 64 + bodyLen sigOff = recOff + recCount * recStride strOff = sigOff + sigCount * sigStride blobOff = strOff + strLen sigValOff = blobOff + blobLen totalLen = sigValOff + sigValLen¶
The header's strOff, blobOff, sigValOff, and totalLen MUST equal these values. In addition:¶
crc32 is CRC-32/ISO-HDLC [ISO13239]: polynomial 0x04C11DB7, reflected, initial value and final XOR 0xFFFFFFFF (the CRC used by zlib). It is computed over [0, totalLen) with the crc32 field treated as four zero bytes. It is written last.¶
The CRC only detects accidental corruption cheaply, before more expensive work. It offers no protection against deliberate modification (Section 19.2).¶
The string table holds exactly strCount entries, followed by zero padding up to strLen. Each entry is:¶
u16 len || len octets of UTF-8 || 0x00 if len is odd¶
Every entry therefore starts at an even offset. The padding after the last entry MUST be zero and shorter than 16 octets.¶
Entries MUST be in strictly ascending order of their UTF-8 octets, compared as unsigned bytes. A proper prefix sorts before any longer string that starts with it, as with memcmp() followed by a length comparison. Strict order also means duplicates are forbidden.¶
Because entries are sorted, entry offsets increase in the same order as entry contents. Within one artifact, comparing two present str_ref values as unsigned integers gives the same result as comparing the strings they point to. The absent value 0xFFFFFFFF sorts after every present value. Section 7.1 relies on this.¶
A present str_ref MUST equal the absolute offset of the len field of one of the strCount entries. Receivers check this against the set of entry start offsets found while walking the table in step B1 (Section 15.2).¶
A present span {off, len} names the octets [off, off + len) inside the Blob section. len MUST be at least 1, so {0, 0} is the only way to encode absence. Spans MUST NOT overlap. Two span fields MUST NOT reference the same octets, even when the content is identical.¶
Blob items are laid out in "span order". Body span fields come first, in increasing field offset. Record span fields follow, in record order, and within a record in increasing field offset. The first present span starts at blobOff. Each later present span starts at the smallest multiple of 16 that is at or past the end of the previous item. The bytes between items MUST be zero. blobLen MUST equal the end of the last item rounded up to a multiple of 16, or 0 if there are no items.¶
This rule leaves no unreferenced or ambiguous octets in the Blob section. A receiver checks it in one pass with no allocation (Section 15.2, step B5).¶
Signature values are not blob items. They have their own section (Section 8.2).¶
A record table holds recCount fixed-stride records. MDA/1 defines three record layouts: the Generic Record (stride 48, Section 7.2), the Trust Record (stride 96, Section 12.14), and the Proof Record (stride 32, Section 12.10). The Type Registry (Section 11) gives each type's layout.¶
Except in ANCHOR_RECEIPT (Section 12.10), records MUST appear in strictly ascending order under this comparison. Duplicate records are therefore forbidden.¶
This order depends only on logical values, never on where strings or blob items happen to sit. The same set of records therefore sorts identically in every artifact that carries it.¶
The order is compared field by field, not byte by byte over the record, because little-endian integers and absolute offsets do not sort correctly as raw bytes.¶
| Off | Size | Field | Type | Notes |
|---|---|---|---|---|
| 0 | 1 | reckind | enum8 | Record kind, closed |
| 1 | 1 | subkind | enum8 | Per-kind subtype |
| 2 | 2 | flags | u16 | Reserved in minor 0 |
| 4 | 4 | field1 | str_ref | Primary string |
| 8 | 4 | field2 | str_ref | Secondary string |
| 12 | 4 | field3 | str_ref | Tertiary string |
| 16 | 8 | ts1 | ts | Start / primary time |
| 24 | 8 | ts2 | ts | End / secondary time |
| 32 | 4 | num | u32 | Numeric value |
| 36 | 4 | (rsv) | u32 | Reserved |
| 40 | 8 | text | span | Long UTF-8 text in Blob |
flags MUST be zero in minor version 0. The text span holds UTF-8 text of 1 to 65536 octets that does not fit in a string; it follows Section 5.3, except for the length limit and the reference rule. Record kinds that do not use text MUST set it absent. A record field that a kind does not use MUST be zero or absent.¶
| kind | Meaning | field1 | field2 | field3 | subkind |
|---|---|---|---|---|---|
| 0x01 | Allergy | substance | reaction | code | severity |
| 0x02 | Medication | name | dose | frequency | route |
| 0x03 | Condition | name | code | codeSystem | status |
| 0x04 | Contact | name | relation | phone | priority |
| 0x05 | Scope | assetId | assetType | category | versOp |
| 0x06 | Tag | tag | (absent) | (absent) | 0 |
Section 13.22 lists which record kinds each type allows. A record kind the type does not allow MUST be rejected (UNKNOWN_ENUM).¶
A Scope record describes a set of assets. field1, when present, is the canonical ID text (Section 3) of one ASSET_MANIFEST assetId. field2, when present, is the name of a contentType value (Section 13.11), such as "lab". field3, when present, is a category that MUST equal the tag of one of the asset's Tag records. ts1 and ts2 bound the asset's capturedAt; 0 means unbounded and both bounds are inclusive. subkind is versionOp (Section 13.21), and num holds the version operand.¶
An asset with ASSET_MANIFEST m matches a Scope record s when every one of the following holds:¶
A set of Scope records matches an asset if any one of them matches.¶
ScopeDigest commits to a set of Scope records in a form that does not depend on where strings sit in the artifact, so it can be compared across artifacts:¶
ScopeDigest = SHA-256( "MDA1SCP\0" || u32 n ||
for each Scope record in canonical order:
u8 subkind || S(field1) || S(field2) ||
S(field3) || u64 ts1 || u64 ts2 || u32 num )
S(x) = u16 len || octets (len = 0 when x is absent)
¶
All integers are little-endian, and n is the number of Scope records. Appendix A.2 gives a test vector.¶
| Off | Size | Field | Type | Notes |
|---|---|---|---|---|
| 0 | 4 | signerDID | str_ref | Signer DID |
| 4 | 1 | alg | enum8 | Algorithm (13.2), closed |
| 5 | 1 | purpose | enum8 | Purpose (13.3), closed |
| 6 | 2 | (rsv) | u16 | Reserved |
| 8 | 8 | signedAt | ts | Signing time |
| 16 | 4 | keyRef | str_ref | Verification method id |
| 20 | 4 | valOff | u32 | Absolute offset of value |
| 24 | 4 | valLen | u32 | Value length (8.2) |
| 28 | 4 | (rsv) | u32 | Reserved |
Signature entries MUST appear in strictly ascending order of (purpose, octets of the signerDID string). Two entries therefore never share the same purpose and signer. signerDID MUST be present.¶
keyRef is a DID URL fragment, including the leading "#", that identifies the verification method within the signer's DID document. It MAY be absent only when the signer is a did:key DID; the key is then the one encoded in the DID itself (Section 8.7).¶
| alg | Algorithm | valLen | Value |
|---|---|---|---|
| 0x01 | Ed25519 [RFC8032] | 64 | Ed25519 signature |
| 0x02 | ML-DSA-44 [FIPS204] | 2420 | ML-DSA signature |
| 0x03 | Ed25519 + ML-DSA-44 (hybrid) | 2484 | Ed25519 signature |
|, |, | || ML-DSA sig.¶
valLen MUST equal the size in the table for the entry's alg. Values sit in the signature value section in signature-entry order. The first starts at sigValOff, and each later one starts at the next multiple of 16 after the end of the previous value. valOff MUST equal that computed position. The padding between values and after the last value MUST be zero, and sigValLen MUST equal the padded total.¶
ArtifactID = SHA-256( A[0 .. sigValOff) )¶
A is the artifact with octets [52, 56), the crc32 field, set to zero. The ArtifactID covers every section except the signature values. That includes the header (and with it every length), the signature entries (signer, algorithm, purpose, signedAt, key reference, and value placement), and the Blob section.¶
Every hash32 field defined as an ArtifactID MUST hold exactly this value. Section 15 rejects every non-canonical encoding, and the signature values are excluded, so two artifacts with the same ArtifactID are the same logical artifact.¶
Each signer signs TBS:¶
For each signature entry, the receiver resolves the verification key (Section 8.7) and verifies the value over TBS with the algorithm the entry names. Ed25519 verification MUST be strict: reject S >= L, reject non-canonical encodings of R and A, reject small-order A, and use the cofactorless equation [S]B = R + [k]A. A receiver MUST reject the artifact if any signature entry fails to verify, including entries that are not required (Section 8.6).¶
The type decides whether an artifact must be signed, never FLAG_SIGNED. Each type has a required purpose and a principal field. A conforming artifact of a "MUST"-signed type has at least one signature entry with the required purpose whose signerDID equals the principal field's string. An artifact may also carry counter-signatures (purpose 0x02) from other DIDs, up to the overall limit of four signatures.¶
| Type | Signed | Required purpose | Signer MUST be (principal) |
|---|---|---|---|
| REQUEST | MUST | author | requesterDID |
| CONSENT | MUST | author | patientDID |
| GRANT | MUST | author | grantorDID |
| RECEIPT | MUST | author | receiverDID |
| REVOKE | MUST | revocation | revokerDID |
| ERROR | MAY | author | reporterDID |
| ASSET_MANIFEST | MUST | author | ownerDID |
| METALOG_RECORD | MAY | author | log owner (12.8) |
| PROVENANCE_COMMITMENT | MUST | author | originatorDID |
| ANCHOR_RECEIPT | MUST | anchor-service | key authorized in TRUST_BUNDLE |
| SNAPSHOT_MANIFEST | MUST | author | ownerDID |
| EMERGENCY_PROFILE | MUST | author | issuerDID |
| EMERGENCY_ACCESS_RECEIPT | MUST | responder | responderDID |
| TRUST_BUNDLE | MUST | bundle-issuer | issuerDID |
| DID_DOCUMENT | MUST | author | see 12.15 |
Verifying a signature requires a public key bound to (signerDID, keyRef, alg). Receivers resolve keys offline, from these sources only:¶
When a key comes from a TRUST_BUNDLE, the receiver MUST also check that signedAt falls within the issuer record's validity interval, that the record's purpose bitmask includes the entry's purpose, and that no revocation record in the most recent verified bundle names the key (Section 16.4). A failure is reported as KEY_UNRESOLVED, SIGNER_NOT_AUTHORIZED, or REVOKED.¶
| alg | Public key encoding | Key length |
|---|---|---|
| 0x01 | Ed25519 public key [RFC8032] | 32 |
| 0x02 | ML-DSA-44 public key [FIPS204] | 1312 |
0x03 | Ed25519 key || ML-DSA-44 key, | 1344.¶
A receiver MAY require hybrid or post-quantum signatures for some types or principals. If an artifact meets every structural rule but not that policy, the receiver reports UNSUPPORTED_ALGORITHM.¶
Every signature covers every signature entry, so all signers of one artifact must agree on the complete artifact, the signedAt of each entry included, before anyone signs. A coordinator assembles the unsigned artifact, sends it to each signer, and collects the values.¶
To endorse an artifact that has already been issued, a party issues a separate PROVENANCE_COMMITMENT (Section 12.9) whose artifactRef is the target's ArtifactID. Appending a signature to an artifact that has already been issued changes its ArtifactID, and is therefore not an endorsement of it.¶
A VB01 frame stores one encrypted asset payload. A frame is a stand-alone file, or the payload of a METALOG_RECORD. It is not an MDA/1 artifact and has its own magic number.¶
| Off | Size | Field | Type | Notes |
|---|---|---|---|---|
| 0 | 4 | magic | bytes | ASCII "VB01" |
| 4 | 1 | ver | u8 | Frame version = 1 |
| 5 | 1 | aead | enum8 | (13.25), closed |
| 6 | 1 | bucketExp | u8 | 8..21 |
| 7 | 1 | flags | u8 | Reserved, zero |
| 8 | 12 | nonce | bytes | Random AEAD nonce |
| 20 | 12 | (rsv) | bytes | Reserved, zero |
| 32 | 32 | keyCommit | hash32 | Key commitment |
The header is followed by the AEAD ciphertext, including its 16-octet tag, which runs to the end of the frame. The frame's total size MUST be exactly 2^bucketExp octets, with 8 <= bucketExp <= 21. The frame size, and nothing else, reveals the bucket.¶
Each asset version has a fresh 32-octet Data Encryption Key (DEK) from a CSPRNG. The nonce is 12 octets from a CSPRNG. Frame keys come from HKDF-SHA256 [RFC5869]:¶
PRK = HKDF-Extract(salt = nonce, IKM = DEK) K_enc = HKDF-Expand(PRK, "MDA1 VB01 enc", 32) keyCommit = HKDF-Expand(PRK, "MDA1 VB01 commit", 32)¶
The encryption key is AES-256-GCM [SP800-38D] under K_enc, with the header nonce, and with AAD equal to the 64-octet header exactly as written, keyCommit included. A receiver MUST recompute keyCommit from its DEK and compare it, in constant time, with the header before decrypting (KEY_COMMITMENT_MISMATCH). AES-GCM alone does not commit to its key; the keyCommit check makes the frame key-committing, which defeats key-partitioning and "invisible salamander" attacks when one DEK is wrapped for several recipients.¶
The per-frame key derivation means that reusing a DEK across frames is safe as long as nonces differ. A DEK MUST NOT be used for more than 2^32 frames.¶
plaintext = u32 plaintextLen || payload || zero padding |plaintext| = 2^bucketExp - 64 - 16¶
plaintextLen MUST NOT exceed 2^bucketExp - 84. The padding MUST be zero; a receiver MUST check this after decryption. The true length exists only inside the ciphertext. No artifact defined in this document carries it in the clear.¶
An encoder MUST pick a bucketExp large enough to hold the payload. It MAY pick a larger one to hide the length better. How a deployment chooses buckets is policy; picking the smallest bucket that fits is RECOMMENDED unless the deployment has a stronger policy. Bucketing hides lengths only to within a factor of two (Section 20.3).¶
A frame's blobHash is SHA-256 over the entire frame. Implementations that store frames as files SHOULD name each file with the lowercase hexadecimal blobHash and use two levels of directory fan-out taken from the first two octets: "ab/cd/abcd...". Before decrypting, a receiver MUST check that a retrieved frame's SHA-256 equals the blobHash it expects.¶
A GRANT gives one recipient the DEK of one asset version, wrapped with HPKE [RFC9180] in single-shot mode.¶
| Suite | KEM / KDF / AEAD | enc | Modes | pk len |
|---|---|---|---|---|
| 0x01 | DHKEM(X25519, HKDF-SHA256) / HKDF-SHA256 / AES-256-GCM (RFC 9180 ids 0x0020/0x0001/0x0002) | 32 | base, auth | 32 |
| 0x02 | X-Wing [XWING] (X25519 + ML-KEM-768) / HKDF-SHA256 /AES-256-GCM | 1120 | base only | 1216 |
hpkeMode uses the RFC 9180 mode values: 0x00 for base and 0x02 for auth. Suite 0x02 MUST use mode 0x00. ML-KEM [FIPS203] has no authenticated encapsulation, so a combination of auth mode with suite 0x02 is invalid and rejected (SEMANTIC_VIOLATION). In every mode, the GRANT signature (Section 8.6) is what authenticates the sender. Auth mode only adds a binding between the KEM shared secret and the grantor's key-agreement key.¶
granteeKeyRef MUST be present. It names a keyAgreement verification method of granteeDID, resolved as in Section 8.7 from a DID_DOCUMENT or a TRUST_BUNDLE issuer record whose subkind is the matching KEM key type (Section 12.14). In auth mode, grantorKeyRef MUST be present and names a keyAgreement method of grantorDID. In base mode it MUST be absent. Encoders MUST NOT derive key-agreement keys from signing keys.¶
The encoder assembles the complete GRANT with wrappedDek set to zero, the HPKE enc already in place in the Blob section at encSpan, and crc32 set to zero. Because enc is an output of encapsulation, the encoder first runs SetupBaseS or SetupAuthS to obtain enc and the context, places enc, and then computes:¶
info = "MDA1 GRANT v1" aad = SHA-256( "MDA1GAD\0" || G[0 .. sigValOff) ) wrappedDek = Seal(ctx, aad, DEK) ; 32 + 16 = 48 octets¶
G is the artifact with crc32 and wrappedDek zeroed. The AAD thus authenticates the whole GRANT, strings and blob included, except the wrapped key itself. encSpan.len MUST equal the suite's enc length. Signing (Section 8.4) happens after wrappedDek is written.¶
A recipient MUST complete validation phases A through D (Section 15) on the GRANT, and on the CONSENT and ASSET_MANIFEST it references, before decapsulating. It then runs SetupBaseR or SetupAuthR with enc and the same info, opens wrappedDek with the same aad (DECRYPTION_FAILED on failure), checks the frame's blobHash against the ASSET_MANIFEST, verifies keyCommit, and decrypts the frame.¶
| Code | Artifact | Body | Stride | Record | Class |
|---|---|---|---|---|---|
| 0x00 | (reserved, invalid) | - | - | - | - |
| 0x01 | REQUEST | 128 | 48 | Generic | control |
| 0x02 | CONSENT | 192 | 48 | Generic | control |
| 0x03 | GRANT | 256 | 0 | - | control |
| 0x04 | RECEIPT | 144 | 0 | - | control |
| 0x05 | REVOKE | 128 | 0 | - | control |
| 0x06 | ERROR | 96 | 0 | - | control |
| 0x10 | ASSET_MANIFEST | 192 | 48 | Generic | card |
| 0x11 | METALOG_RECORD | 112 | 0 | - | bundle |
| 0x12 | PROVENANCE_COMMITMENT | 192 | 0 | - | card |
| 0x13 | ANCHOR_RECEIPT | 160 | 32 | Proof | bundle |
| 0x14 | SNAPSHOT_MANIFEST | 128 | 0 | - | bundle |
| 0x20 | EMERGENCY_PROFILE | 208 | 48 | Generic | card |
| 0x21 | EMERGENCY_ACCESS_RECEIPT | 160 | 0 | - | card |
| 0x30 | TRUST_BUNDLE | 128 | 96 | Trust | bundle |
| 0x31 | DID_DOCUMENT | 128 | 0 | - | card |
| 0x80-0xBF | Experimental Use | any | any | opaque | bundle |
| 0xC0-0xFF | Private Use | any | any | opaque | bundle |
Code points not listed (0x07-0x0F, 0x15-0x1F, 0x22-0x2F, 0x32-0x7F) are unassigned. Receivers MUST reject them (UNKNOWN_TYPE). For experimental and private types, "any" means bodyLen is any multiple of 16 and recStride is any non-zero multiple of 16 when recCount > 0. Section 15.6 gives the processing rules for them. VB01 frames are not MDA/1 artifacts and have no type code.¶
Experimental codes MUST NOT appear in production deployments. Private codes MUST NOT appear in artifacts exchanged outside the organization that assigned them.¶
Body field offsets are relative to the start of the body, which is absolute offset 64. Each subsection lists the semantic rules that step D2 of the pipeline enforces (Section 15.4). Where a rule needs another artifact (a "dependency") that the receiver does not hold, the receiver MUST NOT treat the artifact as authorizing anything (DEPENDENCY_MISSING). It MAY store the artifact and evaluate it again once the dependency arrives.¶
| Off | Size | Field | Type | Notes |
|---|---|---|---|---|
| 0 | 16 | requestId | raw16 | Request identifier |
| 16 | 16 | sessionId | raw16 | Session identifier |
| 32 | 16 | nonce | raw16 | Replay nonce |
| 48 | 8 | issuedAt | ts | Issuance time |
| 56 | 8 | expiresAt | ts | Expiry time |
| 64 | 4 | requesterDID | str_ref | Requester (signer) |
| 68 | 4 | purpose | str_ref | Purpose of use |
| 72 | 2 | requestedActions | u16 | Bitmask (13.4) |
| 74 | 2 | (rsv) | u16 | Reserved |
| 76 | 4 | (rsv) | u32 | Reserved |
| 80 | 32 | requesterVCHash | hash32 | Requester VC digest |
| 112 | 16 | (rsv) | bytes | Reserved |
| Off | Size | Field | Type | Notes |
|---|---|---|---|---|
| 0 | 16 | consentId | raw16 | Consent identifier |
| 16 | 32 | requestRef | hash32 | REQUEST ArtifactID or 0 |
| 48 | 2 | consentVersion | u16 | Starts at 1 |
| 50 | 2 | allowedActions | u16 | Bitmask (13.4) |
| 52 | 4 | (rsv) | u32 | Reserved |
| 56 | 8 | validFrom | ts | Validity start |
| 64 | 8 | validUntil | ts | Validity end |
| 72 | 4 | patientDID | str_ref | Patient (signer) |
| 76 | 4 | granteeDID | str_ref | Grantee |
| 80 | 4 | granteeDisplay | str_ref | Display name |
| 84 | 4 | purpose | str_ref | Purpose of use |
| 88 | 4 | delegateDID | str_ref | May issue GRANTs |
| 92 | 4 | maxGrantTtlSec | u32 | Max GRANT lifetime, s |
| 96 | 32 | scopeDigest | hash32 | ScopeDigest (7.5) |
| 128 | 32 | supersedesRef | hash32 | Prior version ArtifactID |
| 160 | 32 | (rsv) | bytes | Reserved |
| Off | Size | Field | Type | Notes |
|---|---|---|---|---|
| 0 | 16 | grantId | raw16 | Grant identifier |
| 16 | 16 | sessionId | raw16 | Session identifier |
| 32 | 16 | nonce | raw16 | Replay nonce |
| 48 | 8 | issuedAt | ts | Issuance time |
| 56 | 8 | expiresAt | ts | Expiry time |
| 64 | 8 | grantSeq | u64 | Per-pair sequence |
| 72 | 4 | granteeDID | str_ref | Recipient |
| 76 | 4 | grantorDID | str_ref | Grantor (signer) |
| 80 | 4 | purpose | str_ref | Purpose of use |
| 84 | 2 | assetVersion | u16 | Asset version |
| 86 | 1 | hpkeMode | enum8 | RFC 9180 mode, closed |
| 87 | 1 | hpkeSuite | enum8 | Suite (13.6), closed |
| 88 | 16 | assetId | raw16 | Asset identifier |
| 104 | 32 | consentRef | hash32 | CONSENT ArtifactID |
| 136 | 32 | manifestRef | hash32 | ASSET_MANIFEST ArtifactID |
| 168 | 8 | encSpan | span | HPKE enc in Blob |
| 176 | 48 | wrappedDek | bytes | HPKE ciphertext of DEK |
| 224 | 4 | granteeKeyRef | str_ref | Recipient key id |
| 228 | 4 | grantorKeyRef | str_ref | Sender key id (auth) |
| 232 | 24 | (rsv) | bytes | Reserved |
Given the referenced CONSENT c and ASSET_MANIFEST m, every one of the following MUST hold. c and m are dependencies.¶
grantSeq orders the GRANTs between one grantor and one grantee. When two valid GRANTs from the same pair cover the same assetId, the one with the higher grantSeq takes precedence.¶
| Off | Size | Field | Type | Notes |
|---|---|---|---|---|
| 0 | 16 | receiptId | raw16 | Receipt identifier |
| 16 | 16 | sessionId | raw16 | Session identifier |
| 32 | 16 | nonce | raw16 | Replay nonce |
| 48 | 8 | receivedAt | ts | Delivery time |
| 56 | 4 | receiverDID | str_ref | Receiver (signer) |
| 60 | 1 | channel | enum8 | Channel (13.7), open |
| 61 | 1 | outcome | enum8 | Outcome (13.8), open |
| 62 | 2 | (rsv) | u16 | Reserved |
| 64 | 32 | grantRef | hash32 | GRANT ArtifactID |
| 96 | 32 | assetRef | hash32 | SHA-256 of VB01 file |
| 128 | 16 | (rsv) | bytes | Reserved |
| Off | Size | Field | Type | Notes |
|---|---|---|---|---|
| 0 | 16 | revokeId | raw16 | Revocation identifier |
| 16 | 16 | nonce | raw16 | Replay nonce |
| 32 | 8 | revokedAt | ts | Time of revocation |
| 40 | 8 | effectiveAt | ts | Effective time |
| 48 | 4 | revokerDID | str_ref | Revoker (signer) |
| 52 | 4 | reasonText | str_ref | Explanation |
| 56 | 1 | targetKind | enum8 | Kind (13.9), closed |
| 57 | 1 | reasonCode | enum8 | Reason (13.10), open |
| 58 | 6 | (rsv) | bytes | Reserved |
| 64 | 32 | targetRef | hash32 | Target ArtifactID/key |
| 96 | 32 | (rsv) | bytes | Reserved |
targetRef is the ArtifactID of the target artifact. For targetKind key (0x07) it is instead the SHA-256 of the public key encoding (Section 8.7). The revoker must hold authority over the target:¶
| Off | Size | Field | Type | Notes |
|---|---|---|---|---|
| 0 | 16 | errorId | raw16 | Error identifier |
| 16 | 16 | sessionId | raw16 | Session, or 0 |
| 32 | 32 | relatesTo | hash32 | SHA-256 of input octets |
| 64 | 8 | occurredAt | ts | Detection time |
| 72 | 2 | errorCode | u16 | Code (13.24), open |
| 74 | 1 | failedStep | u8 | Pipeline step (15) |
| 75 | 1 | (rsv) | u8 | Reserved |
| 76 | 4 | detailOffset | u32 | Byte offset or ~0 |
| 80 | 4 | message | str_ref | Human-readable text |
| 84 | 4 | reporterDID | str_ref | Reporter |
| 88 | 8 | (rsv) | bytes | Reserved |
| Off | Size | Field | Type | Notes |
|---|---|---|---|---|
| 0 | 16 | assetId | raw16 | Asset identifier |
| 16 | 2 | version | u16 | Starts at 1 |
| 18 | 1 | contentType | enum8 | Type (13.11), open |
| 19 | 1 | bucketExp | u8 | VB01 bucket exponent |
| 20 | 4 | (rsv) | u32 | Reserved |
| 24 | 8 | capturedAt | ts | Acquisition time |
| 32 | 4 | ownerDID | str_ref | Owner (signer) |
| 36 | 4 | title | str_ref | Title, OPTIONAL |
| 40 | 4 | source | str_ref | Origin hint, OPTIONAL |
| 44 | 4 | (rsv) | u32 | Reserved |
| 48 | 32 | blobHash | hash32 | SHA-256 of VB01 file |
| 80 | 32 | priorVersionRef | hash32 | Prior ArtifactID or 0 |
| 112 | 32 | provenanceRef | hash32 | PROVENANCE ArtifactID/0 |
| 144 | 48 | (rsv) | bytes | Reserved |
| Off | Size | Field | Type | Notes |
|---|---|---|---|---|
| 0 | 8 | seq | u64 | Sequence, genesis = 0 |
| 8 | 2 | recordType | u16 | Payload type code or 0 |
| 10 | 2 | flags | u16 | Reserved in minor 0 |
| 12 | 4 | payloadLen | u32 | MUST equal span len |
| 16 | 32 | prevHash | hash32 | Previous recordHash |
| 48 | 32 | payloadHash | hash32 | SHA-256 of payload |
| 80 | 8 | payloadSpan | span | VB01 frame in Blob |
| 88 | 8 | loggedAt | ts | Append time |
| 96 | 16 | (rsv) | bytes | Reserved |
The payload is one VB01 frame at payloadSpan, so payloadLen = payloadSpan.len = 2^bucketExp. payloadHash = SHA-256(payload). recordType is the type code of the MDA/1 artifact encrypted in the payload, or 0 if the payload is opaque. The record's chain hash is:¶
recordHash = SHA-256( "MDA1LOG\0" || prevHash || u64 seq ||
u16 recordType || u16 flags ||
u32 payloadLen || u64 loggedAt || payloadHash )
¶
The genesis record has seq = 0 and a prevHash of 32 zero octets. Each later record has seq = previous seq + 1 and prevHash = previous recordHash. The chain commits to ciphertext, so anyone can audit it without keys. Integrity is relative to a trusted chain head: one from a verified SNAPSHOT_MANIFEST, or from a final ANCHOR_RECEIPT with valueKind chain-head. A METALOG_RECORD MAY be signed by the log owner, whom deployment policy identifies.¶
| Off | Size | Field | Type | Notes |
|---|---|---|---|---|
| 0 | 16 | commitmentId | raw16 | Commitment identifier |
| 16 | 8 | createdAt | ts | Creation time |
| 24 | 1 | targetType | u8 | Target type code |
| 25 | 1 | issuerKind | enum8 | Kind (13.12), open |
| 26 | 2 | (rsv) | u16 | Reserved |
| 28 | 4 | originatorDID | str_ref | Originator (signer) |
| 32 | 4 | subjectDID | str_ref | Subject, OPTIONAL |
| 36 | 4 | displayHint | str_ref | Display hint, OPTIONAL |
| 40 | 4 | (rsv) | u32 | Reserved |
| 44 | 4 | (rsv) | u32 | Reserved |
| 48 | 32 | artifactRef | hash32 | Target ArtifactID |
| 80 | 32 | originatorVCHash | hash32 | Originator VC digest |
| 112 | 32 | priorVersionRef | hash32 | Prior ArtifactID or 0 |
| 144 | 32 | consentRef | hash32 | CONSENT ArtifactID or 0 |
| 176 | 16 | (rsv) | bytes | Reserved |
| Off | Size | Field | Type | Notes |
|---|---|---|---|---|
| 0 | 16 | anchorId | raw16 | Anchor identifier |
| 16 | 8 | anchoredAt | ts | Anchoring time |
| 24 | 1 | backend | enum8 | Ledger (13.13), open |
| 25 | 1 | status | enum8 | Status (13.14), closed |
| 26 | 1 | valueKind | enum8 | Kind (13.15), closed |
| 27 | 1 | (rsv) | u8 | Reserved |
| 28 | 4 | checkpointRef | str_ref | Log/checkpoint label |
| 32 | 8 | leafIndex | u64 | RFC 9162 leaf index |
| 40 | 8 | treeSize | u64 | RFC 9162 tree size |
| 48 | 32 | anchoredValue | hash32 | Value committed as leaf |
| 80 | 32 | rootHash | hash32 | RFC 9162 root hash |
| 112 | 8 | txRef | span | Ledger tx reference |
| 120 | 8 | blockRef | span | Ledger block reference |
| 128 | 8 | evidenceSpan | span | Backend evidence |
| 136 | 24 | (rsv) | bytes | Reserved |
| Off | Size | Field | Type | Notes |
|---|---|---|---|---|
| 0 | 32 | node | hash32 | Audit path node |
The anchored leaf is the RFC 9162 [RFC9162] Merkle leaf over anchoredValue, the 32-octet value itself:¶
leafHash = SHA-256( 0x00 || anchoredValue )¶
Proof records form the RFC 9162 inclusion proof (audit path), in path order from the leaf toward the root. They are exempt from Section 7.1 sorting and may repeat. If status is final (0x02), these MUST hold:¶
If status is pending (0x01) or failed (0x03), leafIndex, treeSize, and rootHash MUST be zero and recCount MUST be 0. Only a final receipt provides any assurance.¶
txRef and blockRef, when present, hold ASCII identifiers chosen by the backend (for example, a hexadecimal transaction hash). evidenceSpan holds the backend's evidence. For backend RFC 3161 TSA (0x05) it is REQUIRED and holds a DER-encoded TimeStampToken [RFC3161] whose messageImprint is SHA-256 over rootHash. All three are covered by the signature. The anchor-service signer MUST be authorized for purpose anchor-service by a TRUST_BUNDLE issuer record.¶
| Off | Size | Field | Type | Notes |
|---|---|---|---|---|
| 0 | 16 | snapshotId | raw16 | Snapshot identifier |
| 16 | 8 | createdAt | ts | Snapshot time |
| 24 | 8 | watermarkSeq | u64 | Highest included seq |
| 32 | 32 | chainHead | hash32 | recordHash at watermark |
| 64 | 32 | indexHash | hash32 | Index state digest |
| 96 | 4 | logRecordCount | u32 | Records retained |
| 100 | 2 | segmentCount | u16 | Segment file count |
| 102 | 2 | (rsv) | u16 | Reserved |
| 104 | 4 | ownerDID | str_ref | Log owner (signer) |
| 108 | 20 | (rsv) | bytes | Reserved |
| Off | Size | Field | Type | Notes |
|---|---|---|---|---|
| 0 | 16 | profileId | raw16 | Profile identifier |
| 16 | 2 | profileVersion | u16 | Starts at 1 |
| 18 | 1 | bloodType | enum8 | (13.16), open |
| 19 | 1 | issuerKind | enum8 | (13.12), open |
| 20 | 1 | resuscitation | enum8 | (13.17), open |
| 21 | 1 | organDonor | enum8 | (13.18), open |
| 22 | 2 | (rsv) | u16 | Reserved |
| 24 | 8 | validFrom | ts | Validity start |
| 32 | 8 | validUntil | ts | Validity end |
| 40 | 4 | patientDID | str_ref | Patient |
| 44 | 4 | issuerDID | str_ref | Issuer (signer) |
| 48 | 4 | displayName | str_ref | Patient name |
| 52 | 4 | preferredLanguage | str_ref | BCP 47 tag |
| 56 | 4 | clinicianName | str_ref | OPTIONAL |
| 60 | 4 | clinicianInstitution | str_ref | OPTIONAL |
| 64 | 32 | issuerVCHash | hash32 | Issuer VC digest |
| 96 | 32 | directiveRef | hash32 | Directive manifest or 0 |
| 128 | 32 | anchorReceiptRef | hash32 | ANCHOR ArtifactID or 0 |
| 160 | 32 | priorVersionRef | hash32 | Prior ArtifactID or 0 |
| 192 | 16 | (rsv) | bytes | Reserved |
A profile is deliberately readable by anyone who holds it. Deployments that need to control who can read it MUST carry the profile content as an encrypted asset (ASSET_MANIFEST plus VB01) with GRANTs, and MUST NOT rely on EMERGENCY_PROFILE for confidentiality.¶
| Off | Size | Field | Type | Notes |
|---|---|---|---|---|
| 0 | 16 | receiptId | raw16 | Receipt identifier |
| 16 | 16 | profileId | raw16 | Accessed profile id |
| 32 | 8 | accessedAt | ts | Access time |
| 40 | 4 | responderDID | str_ref | Responder (signer) |
| 44 | 4 | responderRole | str_ref | Role, OPTIONAL |
| 48 | 32 | profileRef | hash32 | Profile ArtifactID |
| 80 | 32 | responderVCHash | hash32 | Responder VC digest |
| 112 | 1 | channel | enum8 | (13.7), open |
| 113 | 1 | profileCheck | enum8 | (13.19), open |
| 114 | 1 | positionSource | enum8 | (13.20), open |
| 115 | 1 | (rsv) | u8 | Reserved |
| 116 | 4 | lat | i32 | Latitude, 1e-7 degree |
| 120 | 4 | lon | i32 | Longitude, 1e-7 degree |
| 124 | 2 | accuracyM | u16 | Accuracy, metres |
| 126 | 2 | (rsv) | u16 | Reserved |
| 128 | 16 | nonce | raw16 | Replay nonce |
| 144 | 16 | (rsv) | bytes | Reserved |
A receipt is responder-signed evidence of access, collected after the fact (Section 19.11). The position comes from the responder's device and is not attested.¶
| Off | Size | Field | Type | Notes |
|---|---|---|---|---|
| 0 | 16 | bundleId | raw16 | Bundle identifier |
| 16 | 8 | issuedAt | ts | Issuance time |
| 24 | 8 | expiresAt | ts | Expiry time |
| 32 | 4 | bundleVersion | u32 | Starts at 1 |
| 36 | 4 | issuerDID | str_ref | Bundle issuer (signer) |
| 40 | 2 | issuerCount | u16 | Issuer records |
| 42 | 2 | revocationCount | u16 | Revocation records |
| 44 | 2 | checkpointCount | u16 | Checkpoint records |
| 46 | 2 | minAppVersion | u16 | Minimum app version |
| 48 | 32 | prevBundleRef | hash32 | Prior ArtifactID or 0 |
| 80 | 48 | (rsv) | bytes | Reserved |
| Off | Size | Field | Type | Notes |
|---|---|---|---|---|
| 0 | 1 | reckind | enum8 | 0x01/0x02/0x03, closed |
| 1 | 1 | subkind | enum8 | Per-kind subtype |
| 2 | 2 | flags | u16 | Reserved in minor 0 |
| 4 | 4 | field1 | str_ref | Primary string |
| 8 | 4 | field2 | str_ref | Secondary string |
| 12 | 4 | field3 | str_ref | Tertiary string |
| 16 | 8 | ts1 | ts | Valid from / revoked at |
| 24 | 8 | ts2 | ts | Valid until |
| 32 | 4 | num | u32 | Mask / reason / height |
| 36 | 4 | (rsv) | u32 | Reserved |
| 40 | 32 | hashVal | hash32 | Key hash or ArtifactID |
| 72 | 8 | keySpan | span | Raw public key in Blob |
| 80 | 16 | (rsv) | bytes | Reserved |
The canonical record order sorts on reckind first, so the records fall into groups by kind. issuerCount, revocationCount, and checkpointCount MUST equal the number of records of kind 0x01, 0x02, and 0x03, and their sum, computed without overflow, MUST equal recCount (COUNT_MISMATCH).¶
Issuer record (0x01):¶
Revocation record (0x02):¶
Checkpoint record (0x03):¶
Bundle rules:¶
| Off | Size | Field | Type | Notes |
|---|---|---|---|---|
| 0 | 16 | documentId | raw16 | Envelope identifier |
| 16 | 8 | updatedAt | ts | Update time |
| 24 | 4 | version | u32 | Starts at 1 |
| 28 | 4 | targetDID | str_ref | DID described |
| 32 | 32 | documentHash | hash32 | SHA-256 of JSON bytes |
| 64 | 8 | jsonSpan | span | DID document JSON |
| 72 | 8 | (rsv) | bytes | Reserved |
| 80 | 32 | prevVersionRef | hash32 | Prior ArtifactID or 0 |
| 112 | 16 | (rsv) | bytes | Reserved |
Every enumeration is either closed or open:¶
Values not listed below are unassigned. Bitmask fields (Section 13.4) are closed: in minor version 0, undefined bits MUST be zero.¶
The name in quotes is the string that Scope records use (Section 7.4).¶
| Type | Permitted reckind values |
|---|---|
| REQUEST, CONSENT | 0x05 Scope |
| ASSET_MANIFEST | 0x06 Tag |
| EMERGENCY_PROFILE | 0x01 Allergy, 0x02 Medication, 0x03 Condition, 0x04 Contact |
| TRUST_BUNDLE | 0x01 Issuer, 0x02 Revocation, 0x03 Checkpoint |
Record kind values are scoped to the record layout. Generic records and Trust records use separate namespaces.¶
The subkind of a Trust issuer record is a key algorithm: 0x01, 0x02, 0x03 (Section 13.2), 0x10 = X25519 (32-octet key), or 0x11 = X-Wing (1216-octet key). A Trust revocation record's subkind is a targetKind (Section 13.9), which is closed. A Trust checkpoint record's subkind is a backend (Section 13.13), which is open.¶
| Code | Name |
|---|---|
| 0x0001 | INVALID_CRC32 |
| 0x0002 | UNKNOWN_VERSION |
| 0x0003 | BOUNDS_EXCEEDED |
| 0x0004 | OFFSET_MISMATCH |
| 0x0005 | STRING_TABLE_INVALID |
| 0x0006 | INVALID_SIGNATURE |
| 0x0007 | EXPIRED |
| 0x0008 | COUNT_MISMATCH |
| 0x0009 | UNSUPPORTED_ALGORITHM |
| 0x000A | BAD_MAGIC |
| 0x000B | LENGTH_MISMATCH |
| 0x000C | UNKNOWN_TYPE |
| 0x000D | UNKNOWN_CRITICAL_FLAG |
| 0x000E | NON_CANONICAL |
| 0x000F | INVALID_REFERENCE |
| 0x0010 | UNKNOWN_ENUM |
| 0x0011 | MISSING_SIGNATURE |
| 0x0012 | SIGNER_NOT_AUTHORIZED |
| 0x0013 | KEY_UNRESOLVED |
| 0x0014 | REVOKED |
| 0x0015 | NOT_YET_VALID |
| 0x0016 | REPLAY |
| 0x0017 | SEMANTIC_VIOLATION |
| 0x0018 | DEPENDENCY_MISSING |
| 0x0019 | DECRYPTION_FAILED |
| 0x001A | KEY_COMMITMENT_MISMATCH |
Receivers MUST enforce these limits using only header fields (step A4), before any input-dependent allocation:¶
| Limit | control | card | bundle |
|---|---|---|---|
| totalLen (maximum) | 8 KiB | 64 KiB | 4 MiB |
| recCount (maximum) | 64 | 512 | 16384 |
All classes: sigCount <= 4, strLen <= 65536, strCount <= 16384, blobLen <= 3 MiB, sigValLen <= 9984, string len <= 256, text span len <= 65536, DID JSON <= 49152.¶
"KiB" is 1024 octets and "MiB" is 1048576 octets. Every bound is inclusive. Control-class bounds leave room for post-quantum material: a GRANT with suite 0x02 and one hybrid signature takes about 4.1 KiB. The bundle class covers METALOG_RECORDs that carry the largest VB01 frame (2 MiB).¶
A conforming receiver MUST run these steps in order and stop at the first failure, reporting the error code given. No body, record, string, or blob value may reach the application unless every step has passed, except as Section 16.2 permits for emergency profiles. The phases are arranged so that phase A reads only the 64-octet header and the CRC, and phases A and B together need only fixed-size scratch memory (Appendix B).¶
A receiver that sends an error back to the originator does so with an ERROR artifact (Section 12.6), filling in errorCode, failedStep, and detailOffset. Receivers MAY coarsen what they report, for example sending only "rejected", so as not to give an attacker an oracle (Section 19.10).¶
For an experimental or private type, steps A1-A7, B1, B3, C1, and C4 apply. A receiver cannot locate the str_ref and span fields in an opaque body, so B4 is limited to signerDID and keyRef, and the rule against orphan entries and step B5 are skipped. A receiver that does not implement the type MUST NOT expose body fields to the application. It MUST preserve the octets exactly if it stores or forwards the artifact. A receiver that does implement the type applies its full rules.¶
An offline device's clock may be wrong. A receiver keeps a trusted time floor F: the highest issuedAt of any TRUST_BUNDLE it has verified, and the highest anchoredAt of any final ANCHOR_RECEIPT it has verified. It uses now = max(device clock, F). Timestamps from other signers never raise F. The skew allowance is a policy parameter: 5 minutes by default, and at most 24 hours. Receivers MUST reject any signedAt later than now + skew (NOT_YET_VALID).¶
An interval [start, end] is satisfied if start <= now + skew and either end = 0 (where the field permits that) or now - skew <= end. The intervals are: issuedAt..expiresAt for REQUEST, GRANT, and TRUST_BUNDLE; validFrom..validUntil for CONSENT and EMERGENCY_PROFILE; and, for keys from a TRUST_BUNDLE, the issuer record's ts1..ts2.¶
An EMERGENCY_PROFILE that fails D1 MAY still be shown to a responder, with profileCheck expired (0x04) and a prominent warning. It MUST NOT be presented as current, and it MUST NOT be used for any authorization decision.¶
REQUEST, GRANT, RECEIPT, REVOKE, and EMERGENCY_ACCESS_RECEIPT carry a nonce. A receiver MUST remember (type, principal, nonce, ArtifactID) for every artifact of these types it accepts. For REQUEST and GRANT it keeps the entry until expiresAt + skew; for the other types, for at least 30 days. Receiving the same nonce again with the same ArtifactID is an idempotent redelivery: no new action is taken, and no error is raised. Receiving the same nonce with a different ArtifactID MUST be rejected (REPLAY). raw16 nonces make an accidental collision negligible.¶
Offline receivers learn of revocations only from REVOKE artifacts and TRUST_BUNDLE revocation records they have received. A receiver MUST NOT resolve keys from a TRUST_BUNDLE that has expired (expiresAt + skew < now). Deployment policy MAY allow a "stale" mode for break-glass display only. In that mode the stale status MUST be shown, and the artifacts accepted MUST NOT authorize decryption or export. Bundles are accepted only in increasing bundleVersion order along the prevBundleRef chain, so a stale bundle cannot be replayed to resurrect a revoked key.¶
A receiver conforms if it:¶
Every limit is checked from header fields before anything is allocated (A4). The topology is checked with arithmetic that cannot wrap (A6). totalLen must equal the octets actually received (A2), so no step can read past the input. Each of phases A and B is one linear pass. Strings and spans are checked against bitmaps of fixed size (Appendix B), and there is no recursion. Taken together, a malformed artifact costs at most O(totalLen) work and a constant amount of memory.¶
The CRC-32 only screens out accidental corruption cheaply. An attacker can recompute it at will. All protection against deliberate modification comes from the signatures (Section 8). Types that MAY be unsigned (ERROR, METALOG_RECORD) have no integrity protection beyond what Sections 12.6 and 12.8 provide.¶
A signature covers the ArtifactID, and the ArtifactID covers every octet except the signature values and the CRC field. Signature metadata (purpose, algorithm, signedAt, key reference, and value placement), the string table, and the Blob section are therefore all authenticated. Each type has its own requirement for which signatures must be present (Section 8.6), so removing signatures and clearing FLAG_SIGNED produces an artifact that is rejected. Appendix A.4 includes vectors for both attacks.¶
A valid signature proves nothing unless the signer is entitled to make the statement. Section 8.6 binds each type's required signature to its principal field, and Section 12 binds authority across artifacts: who may grant under a consent, and who may revoke what. Key resolution is offline, and it comes from sources the receiver has authenticated: self-certifying did:key identifiers, a chain of trust bundles rooted in pinned keys, and DID documents bootstrapped from those. A DID document cannot vouch for itself (Section 12.15). How the root keys are provisioned is the deployment's main trust decision.¶
A hybrid signature (alg 0x03) is valid only if both components verify. Each component signs the same TBS, and the TBS commits to alg through the ArtifactID. Rewriting alg to remove the post-quantum component therefore invalidates the signature. Receivers can require hybrid signatures as a matter of policy (Section 8.7). ML-DSA-44 targets NIST security category 2, while ML-KEM-768 in X-Wing targets category 3. Deployments that need category 3 signatures need an ML-DSA-65 code point, which a future document can define.¶
Receivers reject every non-canonical encoding. That covers non-zero reserved or padding octets, unsorted or orphaned strings, misordered records, signature entries or blob items, and trailing octets. An artifact therefore has exactly one ArtifactID, and references between artifacts cannot be broken by re-encoding. Strict Ed25519 verification (Section 8.5) makes signature values non-malleable, and in any case signature values are not part of the ArtifactID. NFC is enforced only on the encoder side. A non-NFC string encodes differently, so it gives a different ArtifactID, and it carries the signer's signature over exactly those octets. It is a different signed statement, not a malleable version of an existing one. Applications that compare strings across artifacts SHOULD apply NFC when they compare.¶
The HPKE AAD (Section 10.3) authenticates the whole GRANT. VB01 derives a separate key for each frame and carries a key commitment, which makes AES-GCM key-committing and defeats partitioning-oracle attacks. It also tolerates DEK reuse across frames. DEKs and nonces MUST come from a CSPRNG. Auth mode is not defined for the post-quantum suite. Sender authentication always comes from the GRANT signature, so a recipient MUST NOT decapsulate before the GRANT has passed phases A through D.¶
Every identifier and nonce is 128 random bits, so accidental collisions are negligible; shorter values, such as 32 bits, would collide after about 2^16 values. Section 16.3 defines replay caching; idempotent redelivery is distinguished from replay by the ArtifactID.¶
Offline clocks can be wrong, and revocation information reaches offline devices late. The trusted time floor (Section 16.1) keeps a device from being rolled back to before trust material it has already seen. Monotonic bundle versions keep a revoked key from coming back. Neither mechanism can reveal a revocation the device has not yet received. Deployments SHOULD keep TRUST_BUNDLE lifetimes short, matched to how often their devices synchronize.¶
Verifying signatures is the most expensive step. It happens only after every structural check has passed, and at most four signatures are verified per artifact. Post-quantum verification costs more than Ed25519 but stays well within mobile-class budgets. Detailed error codes are useful for debugging, but they can act as a validation oracle. Receivers facing untrusted peers MAY report only a generic rejection (Section 15.5).¶
EMERGENCY_PROFILE is readable without keys by design, because an unconscious patient cannot authorize access. EMERGENCY_ACCESS_RECEIPT is responder-signed evidence collected after the fact. It deters and attributes misuse; it does not prevent it. Nothing in this document can force a responder to issue a receipt. Its position comes from the responder's device, which can spoof it, and its profileCheck is the responder's own assertion. Deployments that need preventive control MUST encrypt the profile content (Section 12.12).¶
An ANCHOR_RECEIPT is only as trustworthy as its anchor-service key and the receiver's ability to verify the inclusion proof. Receivers MUST verify the RFC 9162 proof against rootHash, and MUST obtain rootHash or a later checkpoint independently, from a TRUST_BUNDLE checkpoint record, before relying on finality. Pending and failed receipts provide no assurance.¶
Comparisons of key commitments, MACs, and HPKE outputs MUST run in constant time. Implementations of Ed25519, ML-DSA, and X-Wing SHOULD resist timing and fault attacks. The hedged ML-DSA variant is RECOMMENDED where fault injection is a concern.¶
Control artifacts, manifests, provenance commitments, and emergency profiles are signed but not encrypted. They can reveal DIDs, display names, purposes of use, and the existence of relationships. Encoders SHOULD leave out every OPTIONAL field that is not needed. Transports SHOULD provide confidentiality where it is available.¶
ASSET_MANIFEST deliberately leaves out the plaintext length and the plaintext hash. A plaintext hash would let anyone holding a manifest confirm a guess at low-entropy documents. contentType, title, source, and tags are visible to anyone holding the manifest, and Section 12.7 recommends minimizing them.¶
VB01 hides lengths to within a power of two. An observer can still see the bucket size, how many frames exist and when, the access pattern, and the METALOG recordType of each entry. Deployments needing more than that should pad to larger buckets, add cover frames, and set recordType to 0.¶
DIDs and raw16 identifiers can link activity across contexts. Patients SHOULD use a separate DID for each relationship (pairwise DIDs) where the DID method supports it. Identifiers MUST be random (Section 3).¶
EMERGENCY_ACCESS_RECEIPT can carry precise coordinates of a patient's location. Encoders SHOULD reduce precision to what accountability needs, and SHOULD set positionSource none when no position is required.¶
IANA is requested to register two media types in the "Media Types" registry [RFC6838].¶
Magic number(s): 4D 44 41 31 at offset 0¶
File extension(s): .mda1¶
Macintosh file type code(s): N/A¶
The second registration, application/mda1-vb01, uses the same template, except: Subtype name: mda1-vb01; Magic number(s): 56 42 30 31 at offset 0; File extension(s): .vb01; Security considerations: Section 9, Section 19.7, and Section 20.3 of this document.¶
IANA is requested to create a "Flat Data Artifact Format (MDA/1)" registry group with the following registries, using the policies of [RFC8126]. Their initial contents are the values in Sections 4.3, 11, and 13.¶
| Registry | Registration policy |
|---|---|
| Artifact Types | 0x01-0x7F Specification Required; 0x80-0xBF Experimental Use; 0xC0-0xFF Private Use; 0x00 reserved |
| Header Flags | Standards Action |
| Signature Algorithms | Specification Required |
| Signature Purposes | Standards Action |
| Key Algorithms (13.22) | Specification Required |
| HPKE Suites | Specification Required |
| Record Kinds | Specification Required (per layout) |
| Closed enumerations | Specification Required |
| Open enumerations | Expert Review |
| Error Codes | Expert Review |
| VB01 AEAD Identifiers | Specification Required |
Designated experts SHOULD check that a new closed value comes with complete processing rules, and that a new artifact type meets the container rules and the alignment and canonicalization requirements of this document.¶
All values are hexadecimal unless noted otherwise. The vectors were produced by an independent reference encoder, and the reference validator accepts them.¶
The signing key is [RFC8032], Section 7.1 TEST 1:¶
secret seed: 9d61b19deffd5a60ba844af492ec2cc4
4449c5697b326919703bac031cae7f60
public key: d75a980182b10ab7d54bfed3c964073a
0ee172f3daa62325af021a68f707511a
did:key: did:key:z6MktwupdmLXVVqTzCw4i46r4uGyosGXRnR3XjN4Zq7oMMsw
T0 = 1795305600000 (2026-11-22T00:00:00Z, decimal)
requestId = 000102...0f; sessionId = 101112...1f;
nonce = 202122...2f
¶
The single Scope record is subkind = 0x03 (latest), field1 absent, field2 = "lab", field3 = "hematology", and ts1 = ts2 = num = 0:¶
ScopeDigest = 6071d110d4bc57295cdef4589f6aa9ae
a523bebf913546720c534acc392a5a10
¶
A REQUEST with that Scope record and one Ed25519 author signature. requesterDID is the did:key above, purpose = "treatment", requestedActions = 0x0001 (read), issuedAt = T0, expiresAt = T0 + 86400000, signedAt = T0, and keyRef absent.¶
totalLen = 432 bodyLen = 128 recCount = 1 recStride = 48 sigCount = 1 sigStride = 32 strCount = 4 strOff = 272 strLen = 96 blobOff = 368 blobLen = 0 sigValOff = 368 sigValLen = 64 strings (in table order): the did:key (56 octets), "hematology", "lab", "treatment"¶
0000: 4d 44 41 31 01 00 01 00 01 00 04 00 b0 01 00 00 0010: 80 00 00 00 01 00 30 00 01 00 20 00 10 01 00 00 0020: 60 00 00 00 70 01 00 00 00 00 00 00 70 01 00 00 0030: 40 00 00 00 37 87 dc 29 00 00 00 00 00 00 00 00 0040: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 0050: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 0060: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 0070: 00 74 8d 00 a2 01 00 00 00 d0 b3 05 a2 01 00 00 0080: 10 01 00 00 5c 01 00 00 01 00 00 00 00 00 00 00 0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00c0: 05 03 00 00 ff ff ff ff 56 01 00 00 4a 01 00 00 00d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00f0: 10 01 00 00 01 01 00 00 00 74 8d 00 a2 01 00 00 0100: ff ff ff ff 70 01 00 00 40 00 00 00 00 00 00 00 0110: 38 00 64 69 64 3a 6b 65 79 3a 7a 36 4d 6b 74 77 0120: 75 70 64 6d 4c 58 56 56 71 54 7a 43 77 34 69 34 0130: 36 72 34 75 47 79 6f 73 47 58 52 6e 52 33 58 6a 0140: 4e 34 5a 71 37 6f 4d 4d 73 77 0a 00 68 65 6d 61 0150: 74 6f 6c 6f 67 79 03 00 6c 61 62 00 09 00 74 72 0160: 65 61 74 6d 65 6e 74 00 00 00 00 00 00 00 00 00 0170: fd 97 2d c0 67 17 fd 1d 98 5a 03 c4 84 8a 3b 96 0180: ac 82 2b e0 da ac d0 89 d1 5a 60 18 c8 7d 07 61 0190: b7 7d 73 3a 63 89 ec 8f b7 c2 7b b2 42 64 ee 6d 01a0: 63 0d 2f 14 0f 5d 1b b4 66 7d df 1a 95 77 a2 09¶
ArtifactID = 1b62d25af0d87deeed4ca1a6880f21b5
07a55fe9c1a3dc036fb8f28bd7ca5c00
TBS = 4d44413153494700 || ArtifactID
Signature = fd972dc06717fd1d985a03c4848a3b96
ac822be0daacd089d15a6018c87d0761
b77d733a6389ec8fb7c27bb24264ee6d
630d2f140f5d1bb4667ddf1a9577a209
crc32 = 0x29dc8737
¶
Each variant below is derived from A.3. Where noted, the CRC is recomputed after the change. A conforming receiver MUST reject every one, with the code shown.¶
| Variant | Expected rejection |
|---|---|
| 16 zero octets appended | LENGTH_MISMATCH |
| last 16 octets removed | LENGTH_MISMATCH |
| totalLen field + 16 | LENGTH_MISMATCH |
| type = 0x07 (CRC recomputed) | UNKNOWN_TYPE |
| FLAG_SIGNED cleared (CRC recomputed) | NON_CANONICAL |
| re-encoded with no signature | MISSING_SIGNATURE |
| purpose author -> counter-signature (CRC) | MISSING_SIGNATURE |
| signedAt + 1 (CRC recomputed) | INVALID_SIGNATURE |
| same content signed by another did:key | SIGNER_NOT_AUTHORIZED |
| any single-bit flip | rejected (INVALID_CRC32 or earlier) |
| any single-octet change outside crc32, | rejected (no octet |
| CRC recomputed | is malleable) |
The frame uses bucketExp = 8 (a 256-octet frame). The plaintext is the ASCII string "MDA1 VB01 test vector" followed by a line feed (22 octets).¶
DEK = 404142434445464748494a4b4c4d4e4f
505152535455565758595a5b5c5d5e5f
nonce = a0a1a2a3a4a5a6a7a8a9aaab
K_enc = 1ac919a7a01e269cb7c65f8bc6c9f561
8ac8f44822e54e41cacbcbb814b1fb49
keyCommit = 37c974687a922fb022000b241931a04d
1a4a01070bb0bfb7f3d7bec38ced9e5b
¶
0000: 56 42 30 31 01 01 08 00 a0 a1 a2 a3 a4 a5 a6 a7 0010: a8 a9 aa ab 00 00 00 00 00 00 00 00 00 00 00 00 0020: 37 c9 74 68 7a 92 2f b0 22 00 0b 24 19 31 a0 4d 0030: 1a 4a 01 07 0b b0 bf b7 f3 d7 be c3 8c ed 9e 5b 0040: af 50 19 d5 e1 d3 aa b0 49 08 87 46 02 eb ed bb 0050: 7d 48 8f b8 b9 45 7e 55 cd 1c 87 1b f1 83 5f 9f 0060: f0 2c 07 95 fc 57 1d b2 72 32 9f 88 90 07 e7 42 0070: 6f 90 98 d6 42 7a 8a 37 66 d0 d9 18 32 50 66 01 0080: bc 4d 5b b9 c4 56 65 2e bd 1e 79 a6 c9 4e 9c f7 0090: f9 29 66 a4 29 7a 0e b0 4e 6f 88 10 90 a1 6a 39 00a0: f9 12 b7 65 40 56 63 61 8e 59 3e 7a b9 92 73 50 00b0: 37 2b ec ce c0 91 f1 94 71 88 5a 10 89 51 5f ec 00c0: 09 71 dc 67 98 6a a8 64 48 e6 e8 d7 ea ba 1b 22 00d0: 61 d4 40 4e c3 3e fc ce d3 4c ad 48 57 cc 82 9f 00e0: a7 6e ff 4f fc 3e 9b ce d4 c5 1c 8b 2e 2d 44 dd 00f0: a7 35 ec 09 d3 ae 28 7b 17 13 9f 70 62 d8 7b f0¶
blobHash = 54fbe6ae5ad5b159689bb3defbd11de0
2027d81d3471ddf8d2926c6be5eb980d
¶
Opening the frame with any other DEK MUST fail at the keyCommit check (KEY_COMMITMENT_MISMATCH) before AES-GCM is run.¶
A topology check for phase A could look like this:¶
<CODE BEGINS>
static inline uint32_t ld32(const uint8_t *p) {
uint32_t v; memcpy(&v, p, 4); return le32toh(v);
}
static inline uint16_t ld16(const uint8_t *p) {
uint16_t v; memcpy(&v, p, 2); return le16toh(v);
}
mda_err mda_frame(const uint8_t *b, size_t n, const mda_type **t)
{
if (n < 64) return MDA_BOUNDS_EXCEEDED;
if (memcmp(b, "MDA1", 4) != 0) return MDA_BAD_MAGIC;
if (b[4] != 1) return MDA_UNKNOWN_VERSION;
uint64_t total = ld32(b + 12);
if (total != n) return MDA_LENGTH_MISMATCH;
if (total > (4u << 20) || (total & 15))
return MDA_BOUNDS_EXCEEDED;
if (!(*t = mda_type_lookup(b[6]))) return MDA_UNKNOWN_TYPE;
/* A4, A5 omitted for brevity */
uint64_t body = ld32(b + 16);
uint64_t rc = ld16(b + 20), rs = ld16(b + 22);
uint64_t sc = ld16(b + 24), ss = ld16(b + 26);
if (body != (*t)->body_len ||
rs != (rc ? (*t)->stride : 0) || ss != (sc ? 32 : 0) ||
(rc && (*t)->stride == 0)) return MDA_COUNT_MISMATCH;
uint64_t str = 64 + body + rc * rs + sc * ss;
uint64_t sl = ld32(b + 32), bl = ld32(b + 40);
uint64_t vl = ld32(b + 48);
if (ld32(b + 28) != str || ld32(b + 36) != str + sl ||
ld32(b + 44) != str + sl + bl ||
((sl | bl | vl) & 15) || str + sl + bl + vl != total)
return MDA_OFFSET_MISMATCH;
return mda_crc_ok(b, n) ? MDA_OK : MDA_INVALID_CRC32;
}
<CODE ENDS>¶