Skip to content

feat(sdk): add opt-in hexless policy binding - #421

Draft
pflynn-virtru wants to merge 1 commit into
mainfrom
optin/hexless-policy-binding
Draft

pflynn-virtru wants to merge 1 commit into
mainfrom
optin/hexless-policy-binding

Conversation

@pflynn-virtru

Copy link
Copy Markdown
Member

Summary

Adds an opt-in hexless policy binding: each key access object's policy binding hash is written as Base64(HMAC), the form the TDF spec defines, instead of the legacy Base64(hex(HMAC)). Default output is unchanged. Mirrors opentdf/platform#4232 (Go).

  • Config.withHexlessPolicyBinding() and the cmdline flag --hexless-policy-binding.
  • A pre-4.3.0 Config.withTargetMode overrides the opt-in and keeps the legacy form, whatever the option order.
  • Reader: when a binding decodes to 32 bytes, the rewrap request carries a copy of the key access object with the binding re-encoded as Base64(hex(HMAC)). Both forms carry the same HMAC, and every KAS verifies the legacy form, so this SDK can decrypt hexless TDFs against any KAS. Legacy bindings pass through unchanged, and the manifest itself is never modified. Older readers forward the binding unchanged and need a KAS with fix(kas): accept spec-compliant policy bindings platform#4223.
  • Known-answer vectors are shared with the Go SDK.

Part of opentdf/platform#3578.

Testing

  • mvn -pl sdk,cmdline -am test: sdk 315, sdk-pqc-bc 28, cmdline 14, all passing.
  • New tests: PolicyBindingTest (known answers for both forms; re-encode only for 32-byte bindings; null and bare-string handling), TDFTest.hexlessPolicyBindingOnEveryKeyAccess (two-KAS split), TDFTest.legacyTargetModeOverridesHexlessPolicyBinding (both orders), TDFTest.rewrapRequestCarriesLegacyBinding, ConfigTest, CommandTest.encrypt_hexlessPolicyBindingFlag_acceptedByPicocli.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Paul Flynn <pflynn-virtru@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

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