code wiki / _hdl_build / nx_cenc.nx

nx_cenc.nx

buildroot/runtime/_hdl_build/nx_cenc.nx

6186 B130 linesdepth 5pulls 7 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_cenc.nx -- STANDARDS-BASED encrypted-media primitives for the Nishi browser's EME path: (1) ClearKey key acquisition (W3C EME `org.w3.clearkey`) -- the license response hands over the content keys IN THE CLEAR as JWK base64url; there is no crypto to break. Legitimate open standard (test streams, self-hosted / internal content, DASH/HLS ClearKey deployments). (2) CENC (ISO/IEC 23001-7) `cenc` scheme = AES-128-CTR SUBSAMPLE decryption GIVEN a content key. Just AES (we already have it): decrypt the encrypted subsample byte-ranges, leave the clear ranges. Given a key you legitimately hold (ClearKey, your own content, test vectors), this is a normal crypto op. This is the CLEAN half of the DRM frontier -- it does NOT extract keys from a commercial license server (that requires impersonating a provisioned Widevine CDM, a separate matter). Reuses nx_aes_ctr + base64.

dependencies 4 imports · 1 importers

nx_syscalls.nx nx_aes.nx nx_aes_ctr.nx base64.nx nx_cenc.nx nx_cenc_gate.nx

imports: nx_syscalls.nxnx_aes.nxnx_aes_ctr.nxbase64.nx

imported by: nx_cenc_gate.nx

structs

none

consts

none

functions

15func cenc_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: cenc_json_str
20func cenc_ctr_iv16(iv: *u8, ivlen: i64, out16: *u8) -> i64
33func cenc_decrypt_subsamples(sched: *u8, iv: *u8, ivlen: i64, data: *u8, dlen: i64, subs: *i64, nsub: i64, out: *u8) -> i64
79func cenc_b64url_decode(s: *u8, n: i64, out: *u8) -> i64
95func cenc_json_str(json: *u8, jlen: i64, field: *u8, out: *u8, ocap: i64) -> i64
called by 1: clearkey_first_key calls 1: cenc_slen
125func clearkey_first_key(json: *u8, jlen: i64, out: *u8) -> i64