Skip to content

feat: Implement Primitive Writer for Streaming and Chunked ZTDF Creation #281

@jrschumacher

Description

@jrschumacher

Problem
The Java SDK currently lacks support for creating ZTDFs via streaming or chunked writes. This requires buffering entire files in memory during encryption, which is inefficient for large-scale data processing. This limitation prevents its use in memory-constrained environments and complicates integrations with cloud services that rely on chunked or streamed data uploads.

User Story
As a Java developer, I want to use a primitive writer interface to construct a ZTDF file. This interface should allow me to write encrypted data segments in any order and then finalize the TDF by generating the manifest and wrapping keys. This would enable me to build efficient, low-memory applications for encrypting and streaming large files.

Misc
This work should align with the primitive interface being introduced in the core Go platform. The goal is to expose a low-level writer that provides flexibility for chunked I/O without compromising security.

To prevent misuse, core cryptographic and policy controls should be abstracted away and remain non-configurable through this interface. Any highly privileged controls that must be exposed should be designated for internal Virtru use and excluded from public documentation.

Acceptance Criteria

Functional Requirements

  • A primitive writer interface, consistent with the platforms design, is implemented in the Java SDK for ZTDF creation.
  • The interface supports writing payload segments in a non-sequential order.
  • A finalization method is provided to complete the TDF creation by writing the manifest and closing the archive.
  • The generated ZTDF files are well-formed and can be decrypted by other TDF SDKs.
  • It is possible to calculate the final TDF size ahead of its creation.

Non-Functional Requirements

  • Performance: The writer should handle data as streams to avoid high memory consumption.
  • Memory: The memory footprint during TDF creation should remain low and not be dependent on the total file size.
  • Security: The public API must not expose controls that could compromise the integrity of the TDFs encryption or policy.
  • Documentation: The public-facing API should be clearly documented, while any internal-only methods are omitted from the public documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions