code wiki / _hdl_build / nx_cenc.nx
nx_cenc.nx
buildroot/runtime/_hdl_build/nx_cenc.nx
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
imports: nx_syscalls.nxnx_aes.nxnx_aes_ctr.nxbase64.nx
imported by: nx_cenc_gate.nx
structs
| none |
consts
| none |
functions
| 15 | func 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 |
| 20 | func cenc_ctr_iv16(iv: *u8, ivlen: i64, out16: *u8) -> i64 called by 1: cenc_decrypt_subsamples |
| 33 | func cenc_decrypt_subsamples(sched: *u8, iv: *u8, ivlen: i64, data: *u8, dlen: i64, subs: *i64, nsub: i64, out: *u8) -> i64 |
| 79 | func cenc_b64url_decode(s: *u8, n: i64, out: *u8) -> i64 |
| 95 | func cenc_json_str(json: *u8, jlen: i64, field: *u8, out: *u8, ocap: i64) -> i64 |
| 125 | func clearkey_first_key(json: *u8, jlen: i64, out: *u8) -> i64 |