Skip to content

fix(sdk): use deterministic BaseTDF IVs (DSPX-4496) - #1018

Draft
dmihalcik-virtru wants to merge 2 commits into
DSPX-4591-zip64-conformancefrom
DSPX-4496-count-iv
Draft

fix(sdk): use deterministic BaseTDF IVs (DSPX-4496)#1018
dmihalcik-virtru wants to merge 2 commits into
DSPX-4591-zip64-conformancefrom
DSPX-4496-count-iv

Conversation

@dmihalcik-virtru

Copy link
Copy Markdown
Member

Summary

  • reserve AES-GCM IV 0 for BaseTDF encrypted metadata
  • assign sequential 96-bit big-endian IVs to payload segments starting at 1
  • enforce a conservative 2^32 per-key invocation ceiling
  • calculate encrypted segment overhead without a throwaway GCM operation

Why

Random per-segment IVs accumulate collision risk at high segment counts. Deterministic per-TDF invocation values guarantee that payload segments do not repeat an IV under their freshly generated payload key.

Verification

  • cd lib && npm test
  • cd lib && npm run lint

The integration test inspects the emitted ZIP payload and verifies segment IVs 1, 2, and 3. Unit tests cover metadata IV 0, counter carry, invalid ranges, and the 2^32 ceiling.

Crypto risk

This construction requires a fresh payload key per TDF, as the normal SDK path already provides. Reusing a custom payload key across TDFs would repeat the IV sequence and is unsafe.

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Signed-off-by: Dave Mihalcik <dmihalcik@virtru.com>
@sonarqubecloud

sonarqubecloud Bot commented Sep 8, 2026

Copy link
Copy Markdown

@dmihalcik-virtru
dmihalcik-virtru added this pull request to stack #1033 September 10, 2026 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant