Skip to content

Object signing (the EMDF protection tag)

A clean-room Atmos stream from this encoder is a valid Atmos-in-E-AC-3 stream: the bed decodes everywhere, and the JOC/OAMD object metadata is spec-correct. But a Dolby-licensed decoder does one extra thing before it will reconstruct the objects — it checks a keyed authenticity tag carried in the stream's EMDF protection field. Without a valid tag it plays the plain 5.1 bed instead of the height-rendered objects (see Atmos & JOC).

iclforge::ac3::signing computes that tag.

The library has no key — you provide it

This is the one thing to take away from this page:

iclforge::ac3::signing contains no key, and never will. Every user of the library supplies their own key at runtime — this project's own tools included, and any consumer outside this project equally. The library cannot sign anything until you hand it a key.

That is a deliberate design boundary, not a gap to be filled later. The signer holds no embedded key, reads none from the build, and has no way to obtain or derive one. What it ships is only the algorithm:

Part Where it comes from In the library?
HMAC-SHA-256 FIPS 180-4 / RFC 2104, public standards Yes — libs/base/src/crypto/, dependency-free
What gets authenticated — which frame regions feed the HMAC, and where the tag is written The public container layout this codec already emits (libs/objects/src/emdf.cpp, the E-AC-3 syntax, TS 103 420) Yes — libs/ac3/src/signing/emdf_atmos_signer.cpp
The key You provision it — exactly as a licensed tool (DEE) receives its own via iLok No — never

A stream signed with a key that does not match a given decoder's simply fails that decoder's check, exactly as an unsigned one does. Providing a key that a particular licensed decoder accepts — and being entitled to use it — is entirely the library user's responsibility, whether that user is this project or someone building on iclforge::ac3::signing elsewhere.

The tag construction, precisely

tag = HMAC-SHA-256(key, A ‖ B), truncated to the primary protection field's width. A is the frame bitstream with its framing/metadata/skip/CRC regions excised and the remainder packed and padded to a 16-bit word. B is the EMDF container content with the protection-tag bits zeroed. The tag is written into protection_bits_primary and crc2 is recomputed. Frames with no object container are left untouched.

Verifying a tag this signer wrote

iclforge::ac3::signing also checks its own tag: verify_atmos_frame/verify_atmos_stream recompute the same HMAC over the same frame regions and compare it against what a frame's protection_bits_primary already holds, without modifying anything. That is useful for round-trip testing, catching tampering or corruption of this project's own signed test assets, and CI/delivery QC — it is not an interoperability path to a real Dolby-licensed decoder. Only that decoder's own proprietary auth gate decides whether a licensed player accepts a stream's objects; this library has no visibility into that gate at all, and checking this library's own tag says nothing about whether a Dolby decoder would too. See What this is not below.

A frame with no EMDF object container is neither "verified" nor "failed" — there is nothing in it to check — so verify_atmos_frame returns one of three outcomes, not a bool:

VerifyResult Meaning
kNoContainer no EMDF object container in this frame — nothing to verify
kValid container present, tag matches the supplied key
kMismatch container present, tag does not match the supplied key

verify_atmos_stream walks every syncframe and returns a VerifySummary (valid / mismatch / no_container counts) — the aggregate shape, mirroring sign_atmos_stream's own frame-count return, rather than a per-frame vector callers would otherwise have to reduce themselves.

A tag only vouches for what it covers, so kValid also requires that the frame's object layer is that container and nothing beside it. The tag hashes the container's content and the audio around it, and every skip field is excised from the authenticated message — so a second payload in another block's skip field, or bytes trailing the container in its own, would sit outside the tag. The signer's own encoder writes exactly one container in one block's skip field and nothing elsewhere; a frame that carries more than that is a kMismatch even when its tag matches, and so is a container that declares no primary protection field (Table H.2.5 reserves protection_length_primary 00; there is no tag to match).

Several keys: the keyring

An operator rarely has one key — a facility signs per show, per year or per customer, and a QC pass has to accept any of them. verify_atmos_stream_any / verify_atmos_frame_any take a list of keys and call a frame valid when any of them reproduces its tag. Signing is per frame, so a stream spliced from material signed under different keys verifies against a list that holds each.

const std::vector<iclforge::base::crypto::SigningKey> ring{key_2025, key_2026};
const auto summary = iclforge::ac3::signing::verify_atmos_stream_any(stream, ring);
// summary.totals.valid / .mismatch / .no_container, and summary.per_key[i]:
// how many frames key i accepted (the first accepting key is credited).

A keyring adds no authority — every key in it is one the operator provisioned, exactly as for a single key. An empty list, or a list of empty keys, accepts nothing: a frame with a container is then a mismatch, never a pass.

Using the library (any consumer)

Any code that links iclforge::ac3 gets a key-less signer and must construct a key to use it. The whole API surface is the key type plus the sign/verify calls:

#include "iclforge/base/crypto/signing_key.hpp"
#include "iclforge/ac3/signing/emdf_atmos_signer.hpp"

// You own the bytes. There is no default, no built-in, no fallback key.
iclforge::base::crypto::SigningKey key{ my_32_key_bytes };          // or:
auto loaded = iclforge::base::crypto::load_signing_key("/path/key"); // file/env resolver

// Sign a whole E-AC-3 elementary stream in place; returns the frames signed.
int n = iclforge::ac3::signing::sign_atmos_stream(stream, key);

// Check it back, without modifying the stream.
iclforge::ac3::signing::VerifySummary v = iclforge::ac3::signing::verify_atmos_stream(stream, key);
// v.valid == n, v.mismatch == 0, assuming `stream` and `key` are unchanged.

Full program: examples/object_signing.cpp — encodes a two-object Atmos stream and signs it; see Object signing in the library reference for the rest of the API surface.

  • SigningKey owns the key bytes and zeroizes them on destruction; it is never persisted.
  • An empty SigningKey (the default) signs nothing — sign_atmos_stream returns 0 and leaves the stream untouched. There is no way to end up signed without having supplied a key.
  • load_signing_key() is a convenience resolver (a path argument, then ICLFORGE_SIGNING_KEY_FILE, then an inline ICLFORGE_SIGNING_KEY) for tools that take a key from the environment; a library consumer can ignore it and construct SigningKey directly from bytes it obtained however it likes.
  • Key format: base64, a 0xHH byte array, or raw bytes. decode_signing_key() (which load_signing_key() uses, and which you can call yourself on bytes you already hold) base64-decodes its input when it is valid base64 — the form a GitHub secret must use, since a secret is text and can't carry a raw binary key — then tries a comma/whitespace-separated 0x56, 0x6c, 0xef, ... byte array, the shape a disassembler or decompiler typically exports a found secret in, and otherwise takes the content as raw key bytes. All three are unambiguous in practice (the array form's 0x prefixes and commas aren't valid base64 characters); plain hex with no 0x prefix is not its own supported format (a hex string is itself valid base64, so the two can't be auto-distinguished). Content that is entirely hex/array-shaped characters (hex digits, x, comma, brace/bracket punctuation) but still fails to parse as either recognized format is refused outright, rather than silently taken as literal ASCII bytes: a mis-copied or truncated array export looks nothing like a random binary key, and signing with the wrong secret this way produces a stream that verifies fine against itself while a real decoder rejects it — the exact failure mode this check exists to turn into a clear error instead. So one base64 value works everywhere: as the CI secret, as ICLFORGE_SIGNING_KEY, or as a signing-key= file — and a raw binary key file, or a copy-pasted 0xHH array, decodes to the same bytes.

Everything below is just how the two front ends in this repository supply their own key — worked examples of the rule above, not additional machinery.

How this project supplies its key

Desktop CLI

Signing is off unless you both ask for it and provide a key:

forge atmos out.ec3 8 448 4 6 objects sign-objects signing-key=/path/to/atmos.key
  • sign-objects requests signing.
  • signing-key=<path> names the key file (preferred — a path doesn't leak into ps/shell history).
  • Or, instead of signing-key=, set ICLFORGE_SIGNING_KEY_FILE (a path) or ICLFORGE_SIGNING_KEY (the key inline, base64 or raw) — the same resolver order load_signing_key() uses.

sign-objects with no key anywhere is a hard error (it won't silently ship an unsigned stream); no sign-objects leaves the container unsigned, and — because a decoder that validates the tag can refuse an unsigned-but-present container instead of falling back to the bed (the receiver in the Raspberry Pi test fell back) — you'll usually want mode bed51 there so the stream omits the container and plays as 5.1 everywhere. See CLI metadata options.

decode/monitor have the mirror-image option, verify-objects, to check a stream's tag instead of writing one:

forge decode signed.ec3 out.wav verify-objects signing-key=/path/to/atmos.key
  • Checking is just as opt-in as signing: verify-objects is off by default, and a decode or monitor invocation with no verify-objects plays a signed stream exactly like an unsigned one — it never routes through the checker at all. Eac3Decoder itself never gains any knowledge of iclforge::ac3::signing; the check runs separately, over the same raw stream bytes, and only when the operator asks for it.
  • With verify-objects and a key, every frame's tag is checked and a summary is reported (N valid, M mismatched, K unsigned). Any mismatch is a hard failure — the command refuses, exactly like sign-objects refuses a request with no key — rather than decoding some frames and silently skipping others: a signed stream is either verified or the command refuses, never a silent partial pass.
  • verify-objects with no key anywhere is the same hard error sign-objects gives.
  • A frame with no object container (a plain AC-3/E-AC-3 stream, or an Atmos bed51 stream) reports as unsigned, not as a mismatch — there is nothing in it to check.
  • signing-key= repeats. Give it once per key and a frame is good under any of them; the summary then says which key accepted how many (object signature: 40 valid (key 1 (a.key) 30, key 2 (b.key) 10), 0 mismatched, 0 unsigned frame(s)). With paths given the environment variables are not consulted, so an exported ICLFORGE_SIGNING_KEY cannot quietly widen the set. sign-objects signs with exactly one key and refuses a second.

gate-objects is the other policy, the licensed one:

forge decode show.ec3 out.wav gate-objects signing-key=/keys/2025.key signing-key=/keys/2026.key
  • A frame whose object layer verifies is decoded as objects; any other frame — unsigned, signed under a key not in the set, or altered after signing — is decoded as its 5.1 bed, and the command carries on and succeeds. That is what a licensed AVR does with a stream it cannot authenticate, and the opposite of verify-objects, which refuses.
  • The decision is per syncframe, like the tag. A stream that is good for a stretch and unsigned after it plays as objects and then as its bed.
  • It is built from the pieces above, not a second path into the decoder: a frame that does not verify has its object layer removed by the same lossless rewrite strip_objects does (the bed audio is bit-identical, no re-encode), and the decode runs over the result. Eac3Decoder still never learns that signing exists, and the gated stream is an ordinary stream any decoder plays.
  • It fails closed. A frame that carries an object layer this build can neither verify nor remove (a shape outside the frame walker's scope) is an error, not a pass — passing it on would play objects nothing authenticated. A stream with no object layer at all is not an error.
  • gate-objects and verify-objects cannot be combined: one says "refuse" and the other "play the bed".
  • Like verify-objects, it needs a key and is a usage error on AC-4.

Shield app (on-device signing)

The Shield demo signs each frame on the device, so its key has to be present in the APK as a bundled asset, app/src/main/assets/signing.key — gitignored, never committed. It is materialized from the ATMOS_SIGNING_KEY repository secret at build time, and the app decodes it (base64 or raw) through the same decode_signing_key() the CLI uses:

  • Both ci.yml and release.yml forward the secret to the build-android job, which writes the base64 secret verbatim into the asset before the Gradle build. Signing is gated purely on the secret being set — so any Shield build signs when it is, debug or release. With no secret (or on a fork PR, where secrets don't flow) the step is skipped and the build is the safe, unsigned app.
  • Locally, drop your own signing.key (base64 or raw bytes) into app/src/main/assets/ before building.

At startup the app loads the asset; present → the object container is emitted and signed, absent → the app streams the unsigned bed51-equivalent, always safe on any receiver.

A signed APK contains the key

On-device signing means the key ships inside any signed-build APK as that asset — and since the secret gates every build, that includes the debug APK CI produces on each push, not just releases. Anyone with such an APK can extract the key, so it is as sensitive as the key itself: sideload it to your own device and never distribute it. See Android.

Sibling: TrueHD Evolution

TrueHD carries its object audio metadata in an evolution frame in the extra data of an access unit (TH spec §15.4, §16.1), and that frame has an evo_protection() field with the same shape as E-AC-3's EMDF one. iclforge::truehd::signing (libs/truehd/include/iclforge/truehd/signing/evolution_signer.hpp) gives it the capability set this page describes for E-AC-3: sign, verify against one key or a keyring, a key-free "is a tag present" check, and a gate that falls back to the bed. A TrueHD stream does not need any of it: a bed-only stream is valid with no evolution frame at all.

tag = HMAC-SHA-256( key, M ) [ : Np / 8 ]

Np is the width of the primary protection field (1, 4 or 16 bytes, from its length code). M is the whole access unit with four regions zeroed and nothing else changed: the primary and secondary protection fields; the zero fill inside the evolution payload after the frame; the extra data's padding between the payload and its parity byte; and the parity byte. Everything else is covered: the unit's header word (its check nibble and length) and input_timing, the substream directory, the major sync with its CRC, every substream segment, and the evolution payload's version, key id, payload ids, configurations and bytes. So an edit to the object metadata, the major sync, the directory or the audio fails the tag, and an edit to the padding, the fill or the parity does not (it gives the extra data's own parity error). Signing writes the tag and recomputes the parity byte (TH spec §16.4); no length, no payload size and no check nibble changes, so a signed stream is exactly as long as the unsigned one. Nothing is carried from one unit to the next.

  • Sign after the last edit. Because the major sync is covered, forge metadata with a channel-meaning edit and sign-objects together edit first and sign second; editing a signed stream without signing again leaves its tags failing (and forge says so).
  • Sole container. Because the fill and the padding are outside the message, a frame is signed and verified only when the extra data holds nothing else: no bytes after the container inside the payload, zero padding after it. A frame with more than that is a mismatch even when the digest matches, and signing refuses such a frame (it returns false and changes nothing, rather than write a tag that would then fail). That is one more condition than an empty key, no readable frame and a primary length code of 0.
  • No stream signature. A cut or a joint at unit boundaries leaves every tag valid, and the audio between the tags is covered only unit by unit. This is a property of a per-frame tag. TrueHD spec §16.3.3 still holds: no TrueHD stream carries a whole-stream content signature, and this library does not add one; there is no plan to. AC-4 has one, and it is a separate scheme.

This is iclforge's own scheme. The coverage follows what is observed of the tag in streams from the Dolby tools (it reaches the object metadata, the major sync and the unit header and directory, and not the padding, the fill or the parity). The algorithm and the key of those tags are not public and are not derived or searched for here, and the construction is HMAC (RFC 2104) and SHA-256 (FIPS 180-4) under your key: the library never embeds, derives or searches for one (SigningKey, the same signing-key= file or ICLFORGE_SIGNING_KEY[_FILE] as for E-AC-3). It cannot make a tag a licensed decoder accepts, and a kValid says only that the tag matches the key you supplied.

What a licensed Dolby decoder does with it. It holds other keys, so it reads these tags as failing, as it reads an unsigned stream's. With the Atmos flag set in the major sync it enforces the tag: two failing evolution frames in a row end the output about one access unit early per report, one failing frame is tolerated, a valid frame between failures resets the count, and a stream with few or no evolution frames is not affected. The bed that is played is a bit-exact prefix of the bed. That is how the decoder treats a tag it does not hold the key for, and it is the operator's choice whether to sign (for this library's own check and gate), to leave the stream unsigned, or to gate it: gate-objects removes the object layer from every unit whose tag does not verify, which leaves a stream with no failing frame by construction (tested), and the bed plays full length.

How strong the tag is. The field is as wide as its length code says, and every stream observed has used one byte. A one-byte tag is accepted by a wrong key about once in 256 units, so on a stream of any length some unsigned or foreign frames pass by chance (2 of 63 did on a real stream). It detects tampering and mix-ups; it does not authenticate, and the gate is no stronger than that per unit. The signer does not choose the width: it writes the tag into the field the unit has, and a wider field is a different stream variant for the writer of the stream to choose.

Function (iclforge::truehd::signing) forge
Sign, in place sign_evolution_unit, sign_evolution_stream metadata <in> <out> sign-objects signing-key=<path> (alone or with the channel-meaning edits, which come first); a stream written by an encoder that signs needs no second step
Is a tag present, no key has_evolution_tag, count_evolution_tags probe: protection tag present in N/M frame(s); JSON truehd.evolution.protection.tagged_frames
Verify verify_evolution_unit, verify_evolution_stream (kNoContainer, kValid, kMismatch) decode <in.thd> <out.wav> verify-objects signing-key=<path>: a mismatch refuses the command
Keyring verify_evolution_unit_any, verify_evolution_stream_any repeat signing-key=; the status line credits each key
Licensed policy gate_evolution_stream decode ... gate-objects signing-key=<path>

gate_evolution_stream decides per access unit. A unit whose frame verifies is copied byte for byte; any other unit with extra data (unsigned, another key's, altered, unreadable) has its extra data rewritten to the padding-only form (header word zero and zero words; TH spec §16.2) and nothing else, so the substreams are untouched and the bed decodes bit-identically with no re-encode and no change of length. A gated unit's object channels (substream 3) have no metadata left to place them, so gate-objects refuses truehd-presentation=all when it gated anything; the other presentations read substreams 0 to 2. The gate fails closed: bytes that do not read as an access unit are an error, not a pass. verify-objects and gate-objects are not combinable, as for E-AC-3. Decode without either option reads no tag, as before.

The container reading (kEmdf or kSpec36, ERRATA question 23) is still open; the tag's construction is the same under both and every function takes the reading as its last argument (kEmdf by default). tools/references/truehd_evolution_signing.py is an independent Python transcription; the C++ and Python signers write the same bytes (libs/truehd/tests/signing/test_evolution_signer.cpp). This is a new extension, not an interoperability claim.

Sibling: AC-4

AC-4 objects carry no EMDF tag in this project. The AC-4 encoder writes its EMDF containers with no protection bytes (libs/ac4/ERRATA.md), and the decoder reconstructs objects without a key. See AC-4.

AC-4 has its own, different signature, and it is not per frame or per object: one ECDSA P-256 signature over the whole stream (SHA-256 of every byte before it), made with the operator's own private key and X.509 certificate chain, serialised with Thrift and written after the last sync frame of a raw .ac4 file. The frames are not touched, so a signed file decodes as the unsigned one. The rest follows this page's stance:

  • It is opt-in everywhere: nothing signs or checks unless ac4-sign, sign-content, ac4-verify, verify-content or check-content is given, and a key, chain or trust option without the command that uses it is refused rather than dropped.
  • The key and the chain are the operator's (content-key=, content-chain=, or ICLFORGE_CONTENT_KEY_FILE / ICLFORGE_CONTENT_KEY and ICLFORGE_CONTENT_CHAIN_FILE), read at run time, zeroized, never stored; no key, certificate or fingerprint of any issuer ships.
  • It has a strict mode and a report mode, as the EMDF tag has: verify-content refuses a stream unless the signature, the chain and an anchor all check, check-content says what it finds and carries on.
  • It cannot call a signature valid on its own say-so. The chain has to lead to a trust-anchor= certificate or a pin= fingerprint the operator names. A signature that checks out against a chain nothing the operator trusts vouches for is reported as chain unanchored (ac4-verify exits 6 and decode exits 2, unless unanchored-ok), which says the file agrees with its own signature and nothing about who made it.
  • Certificates are judged at the time verify-time= names: now (the specification's, and the default of ac4-verify and verify-content), the date the signer wrote (only as good as the signer, and the default of check-content, which reports and carries on), a given instant or never.
  • The signature names who made it (publisher UUID and name, product, platform), as CS spec v2.6 section 5.3 describes. ac4-sign takes these as options and ac4-verify reports them. The publisher UUID is the PACE account's and is not in the signing certificate, so it is compared with nothing unless expect-publisher-uuid= names the accounts you accept; verify-content refuses a UUID that is missing or that is none of them. Only a raw .ac4 stream is signed: signing an MP4 is out of scope (section 8.3.2) and is refused by name.

  • A bring-your-own-key signature is not Dolby's. The signature chains to the certificates you supply, so it proves one thing: the stream is the one whose holder of your key signed it, and not a byte of it, or of the signer information, has changed since. It does not chain to Dolby's (or PACE's) trust root, and this project ships no key, certificate or fingerprint of either, so a licensed Dolby decoder, player or receiver that checks a content signature against Dolby's root will not treat the stream as Dolby-authentic, and a signed file does not become "certified" by being signed. What a verifier can conclude depends on what it trusts: with trust-anchor=, pin= or trust-key= naming your signer it can say "valid" (your key signed this), with nothing named it can only say untrusted (the file agrees with its own signature, which anyone could have made with a key of their own). The signature carries no encryption and no protection against copying; anyone who strips the trailer has an unsigned stream that plays the same, and no-signature is how a verifier tells. Guard the private key as you would a code-signing key: the library wipes its copies, but a key file, a process environment or a core dump is yours to protect.

See Signing for the API, and libs/ac4/ERRATA.md for what was measured on a real signature and the questions still open.

Decode modes

Three policies for decode into multi-channel / objects, all shipped:

Mode Intent How
Unchecked (default) FOSS-style: reconstruct objects without checking the tag Omit both options
Verify Multi-key HMAC QC; mismatch fails the command verify-objects with one or several signing-key=; verify_atmos_stream_any (TrueHD: verify_evolution_stream_any)
Licensed AVR-like: match → reconstruct; mismatch / unsigned → bed only, decode continues gate-objects with one or several signing-key=; gate_atmos_stream

Sign remains single-key (sign-objects). Keys are always operator-provisioned; nothing here forges a licensed decoder's secret.

What no mode does is make a Dolby-licensed decoder accept a stream. That decoder checks its own tag with a key and construction this project does not have and will not ship — a stream this project signs plays as objects there only for someone who provisions that key, which is theirs to hold and to be entitled to use. The project's own object-unlock is therefore a personal-use path, never a shipped one; it is a known and accepted gap, not an open task.

What this is not

  • Not content protection. "Protection" in the EMDF protection field, and on this page, names an authenticity tag that gates object decoding. It encrypts nothing. It has no relation to Common Encryption (ISO/IEC 23001-7), to DRM, or to a Common Encryption key ID: the EMDF key_id selects an authentication key and nothing more. An MP4 protected with Common Encryption is a separate matter; the MP4 reader refuses such a track and says so.
  • Not a key you get from us. The library ships the machinery, never a key — see above. Whoever uses it, in this project or outside it, brings their own and is responsible for being entitled to use it.
  • Not a reconstruction of Dolby's own tag algorithm. The construction here is derived from the public container layout, not from a licensed decoder. Whether a given decoder accepts a tag depends on the key you supply matching that decoder's expectation.
  • verify-objects/verify_atmos_stream are not a Dolby-decoder compatibility check either. They check this library's own tag, computed with a key you supply — useful for round-trip testing and catching tampering in this project's own signed assets, but a kValid result says nothing about whether any particular licensed decoder would accept the same stream, and a kMismatch says nothing about why a licensed decoder might refuse one. Nothing in this project reconstructs or replicates Dolby's own gate — see the opening paragraph above.
  • Not required for object motion to be audible. AtmosEncoder pans every object into the transmitted 5.1 bed regardless of signing, so movement is audible on any decoder — signing is what lets a validating decoder reconstruct the objects as discrete, height-rendered sources rather than panned into the bed. See Atmos & JOC.