Commit Graph
4 Commits
Author SHA1 Message Date
tkgstratorandClaude Sonnet 4.6 661af0abac feat(crypto): implement build_scheme_data_352() for complete 352B appboot scheme_data
Reverse-engineered the full 352B key 33.6 scheme_data structure from iOS MSL
appboot captures and implemented NetflixCrypto.build_scheme_data_352().

Structure (verified against real captures):
  [0:135]   - Fixed 135B CBOR header (IOS_SCHEME_DATA_HEADER_135B constant)
  [135:263] - 128B TFIT-WB-AES-128-ECB(DH_pub_key) output
  [263:352] - 89B CFB-chain encrypted CBOR tail (IV = TFIT[-16:])

Tail plaintext (82B + 7B PKCS#7 padding):
  key 30: tstr "AUTHENTICATED_DH"
  key 22: uint64 message_id (random per-request)
  key 40: bool false
  key 21: bool true
  key 24: uint64 timestamp (UNIX seconds)

- Add IOS_SCHEME_DATA_HEADER_135B constant to constants.py
- Add NetflixCrypto.build_scheme_data_352() to crypto.py
- Replace old build_key336_scheme_data() / build_key_request_data() in
  test_appboot_e2e.py with the new API (removes incorrect nonce-xor structure)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 17:19:32 +00:00
tkgstratorandClaude Opus 4.6 e74869dbf5 feat(cbor): Netflix カスタム CBOR エンコーダー実装 — パースエラー解消
- nf_cbor_encode(): Netflix 互換 CBOR エンコーディング
  - 全整数キーを 8 バイト形式 (0x1b + uint64) でエンコード
  - 全 map の前に tag(55799) (0xd9d9f7) を付与
- test_appboot_e2e.py を cbor2.dumps → nf_cbor_encode に移行
- サーバーエラーが errorcode=1 (パース失敗) → errorcode=6 (AppID検証) に前進
- verify_full_key_chain.py 13/13 PASS 維持

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 15:58:34 +00:00
tkgstratorandClaude Sonnet 4.6 455de1ebee feat(crypto): implement build_session_region() with TFIT-WB-AES DH key encryption
Add session_region builder for key 33.6 scheme_data (plaintext[128:300] = 172B).
Emits 7B constant CBOR prefix + 128B TFIT-WB-AES-ECB(DH_pub_key) + 37B zero-filled
MGK tail (CBOR encoding TBD). Falls back to bytes(172) if NFWebCrypto binary absent.
Update test_appboot_e2e.py to call build_session_region() instead of hardcoded zeros.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 15:47:05 +00:00
tkgstratorandClaude Sonnet 4.6 9be376736d feat(appboot): add e2e test script and simplify iOSMslClient architecture
Corrects entity_auth_data CBOR structure based on 243 captured requests:
- scheme name is "MGK_APPID" (not "FAIRPLAY_MGK_APPID")
- apphmac is device_id_token UTF-8 bytes, not a computed HMAC
- devicetoken is base64.b64decode(device_id_token) raw bytes
- integer key 3 for ESN (not string key); no device_key_data or esn_prefix
- identity (key 33.8) is full ESN without "_3" suffix
- signature = HMAC-SHA256(sign_key_0, key_request_data_bytes) only

iOSAppbootParams simplified: removes device_key_data, apphmac, devicetoken,
renewable, capabilities, esn_prefix. Adds optional device_id_token for
subsequent sessions. CBOR building moved inline into iOSMslClient.

New tools/test_appboot_e2e.py performs the full chain: TFIT emulation ->
Phase 3 KDF -> DH keygen -> CBOR build -> POST appboot.netflix.com ->
response parse. Handles both CBOR success and JSON MSL error responses.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 15:24:01 +00:00