SERVER / CRYPTO

Transform protected byte streams

crypto is a Dowe-owned server declaration for byte transforms. It names the transformed binding first, then makes the encryption mode and key material explicit.

1 / MENTAL MODEL

Declare the output and encryption mode

The binding after crypto is available to later server statements. encryption selects the byte transform, while data, key, and iv preserve a clear data flow without exposing server secrets to views.

dowe
handler decryptSegment
  http upstream method:"get" base:env.MEDIA_BASE_URL path:"/segment.m4s" mode:"bytes"
  crypto encrypted encryption:"cencAesCtr" data:upstream key:env.MEDIA_KEY iv:env.MEDIA_IV
  return bytes:encrypted contentType:"video/mp4"
Part
Contract

No data

There are no records to display

2 / CENC

Preserve clear ranges in encrypted samples

cencAesCtr supports an 8-byte or 16-byte IV and optional clear and encrypted subsamples. Clear bytes remain unchanged while encrypted ranges advance the AES-CTR stream.

dowe
crypto encrypted encryption:"cencAesCtr" data:upstream key:env.MEDIA_KEY iv:sampleIv subsamples:[{ clear:5 encrypted:1024 } { clear:0 encrypted:2048 }]
return bytes:encrypted contentType:"video/mp4"
Concern
Guidance

No data

There are no records to display