Standards
External files and content_hash: keeping recordings out of the JSON safely
When to inline a file or reference it, how the sha512 content_hash token is formed, and how a verifier checks fetched content under draft-ietf-vcon-vcon-core-05.
IETF working group draft Last updated 18 November 2026
Inline or external
The core draft, draft-ietf-vcon-vcon-core-05, lets any object that carries a file (dialog, attachment, analysis) hold it in one of two ways 1. Inline files use a body plus an encoding, where encoding is base64url, json or none, or a value defined by an extension 1. External files use an https url plus a content_hash 1. Inline is simplest and keeps everything under one signature, but a recording of a few minutes makes the document large; external keeps the vCon small but makes integrity your problem, which the hash solves.
The content_hash format
The token is the lowercase algorithm name, a hyphen, and the base64url encoding of the digest, as defined by reference to the STIR PASSporT approach 1. SHA-512 support is mandatory and the algorithm name is sha512; others from the COSE algorithm registry's recommended set MAY be added 1. When more than one hash is wanted, content_hash can be an array of tokens 1. The hash covers the exact bytes served at the url 1. In the draft's own externally referenced example the hash after the prefix is 86 characters, the length of an unpadded base64url SHA-512 digest 1.
import base64, hashlib, urllib.request
def content_hash(data: bytes) -> str:
"""sha512 token: algorithm, a hyphen, unpadded base64url digest."""
digest = hashlib.sha512(data).digest()
return "sha512-" + base64.urlsafe_b64encode(digest).rstrip(b"=").decode()
def verify_external(url: str, expected) -> bytes:
"""Fetch a file by HTTPS and check it against one or more content_hash tokens."""
if not url.startswith("https://"):
raise ValueError("external files must use HTTPS")
data = urllib.request.urlopen(url, timeout=30).read()
tokens = [expected] if isinstance(expected, str) else list(expected)
sha512 = [t for t in tokens if t.startswith("sha512-")]
if not sha512:
raise ValueError("no sha512 token to check")
if content_hash(data) not in sha512:
raise ValueError("content_hash mismatch")
return data
Choosing between the two
- Short text, small JSON analysis and thumbnails suit inline storage: one file, one signature, no second fetch. Encoding json keeps JSON bodies readable instead of base64url 1.
- Recordings, video and large documents suit external storage, with url, content_hash and a mediatype. The mediatype may come from the HTTPS Content-Type header when absent in the vCon 1.
- In practice, decide by size and by who needs the bytes. If a receiver always needs the audio, inline plus gzip may be simpler than running a second service, and if only a few receivers do, external references avoid shipping it to everyone.
Whichever is chosen, an Object that has a file should say what it is. The draft makes mediatype mandatory for inline dialog and attachment files, and for external ones when the server does not supply a Content-Type 1.
How the signature protects an external file
When a file is external, the vCon's signature does not secure the file, so the draft has the url and hash included in the signed vCon 1. Signing the vCon then carries the hash with it, and verification becomes a two-step chain: check the signature, then check each fetched file against its hash before using it 1. The draft explains that SHA-512 was chosen because it is cheap to compute for very large media files 1.
Operational notes
- Access control is separate. The draft leaves storage security and the credentials for fetching external data out of scope, to be exchanged out of band 1.
- A moved or renamed file breaks the vCon's url but not the hash. A lookup from hash to current location helps here; the draft does not define one.
- A redacted vCon may omit a dialog's body or url, so a consumer should expect files to be missing 1.
- The same rule covers references to other vCons: redacted_from and amended_from may carry url, and then content_hash MUST be present 1.