Package zeroecho.sdk.builders


package zeroecho.sdk.builders
Builders for composing streaming data-content pipelines across core sources and algorithm-specific stages.

This package groups the top-level builder APIs used by the SDK to create streaming DataContent pipelines. It ties together the generic chain and plain-source builders from zeroecho.sdk.builders.core with the algorithm-focused builders from zeroecho.sdk.builders.alg, and provides cross-cutting utilities such as TagTrailerDataContentBuilder.

What lives where

Chaining model

Pipelines are assembled by creating a DataContentChainBuilder in encrypt or decrypt mode and adding builder stages in order. Each stage is built in the selected mode, linked to the previous tail via setInput(...) and exposed as a single tail DataContent.

Headers, trailers, and verification

  • Symmetric builders can emit compact headers containing non-secret parameters (for example, IV or nonce) and parse them on decrypt.
  • Signature and MAC builders support pass-through or emit-only forms for signatures or tags.
  • TagTrailerDataContentBuilder focuses on trailer-style tags with explicit verify policies.
  • SignatureTrailerDataContentBuilder provides the corresponding trailer functionality specialized for digital signatures, including hybrid signature construction.

Typical usage

// Build a simple HMAC trailer pipeline over a plain string and append the tag.
zeroecho.sdk.content.api.DataContent macEnc =
    zeroecho.sdk.builders.core.DataContentChainBuilder.encrypt()
        .add(zeroecho.sdk.builders.core.PlainStringBuilder.builder().value("hello"))
        .add(new zeroecho.sdk.builders.TagTrailerDataContentBuilder(
                zeroecho.core.tag.TagEngineBuilder.hmac(secretKey, zeroecho.core.alg.hmac.HmacSpec.sha256())))
        .build();

// Build the corresponding verification pipeline that strips the trailer and throws on mismatch.
zeroecho.sdk.content.api.DataContent macDec =
    zeroecho.sdk.builders.core.DataContentChainBuilder.decrypt()
        .add(new zeroecho.sdk.builders.TagTrailerDataContentBuilder(
                zeroecho.core.tag.TagEngineBuilder.hmac(secretKey, zeroecho.core.alg.hmac.HmacSpec.sha256())))
        .build();

Thread safety

  • Builder instances are mutable and not thread-safe; configure and use each instance on a single thread.
  • Produced DataContent stages are single-use and should not be shared across pipelines.
Since:
1.0