Class SignatureTrailerDataContentBuilder
java.lang.Object
zeroecho.sdk.builders.SignatureTrailerDataContentBuilder
- All Implemented Interfaces:
DataContentBuilder<DataContent>
public final class SignatureTrailerDataContentBuilder
extends Object
implements DataContentBuilder<DataContent>
Signature-specific trailer builder for
DataContent pipelines.
This class is intended as a convenient, signature-specialized replacement for:
new TagTrailerDataContentBuilder<Signature>(engine).bufferSize(8192) new TagTrailerDataContentBuilder<Signature>(engine).bufferSize(8192).throwOnMismatch()
It keeps TagTrailerDataContentBuilder as the generic implementation
while providing a compact API for Signature usage, including
construction of SignatureContext for both single-algorithm and hybrid
signatures.
Mode selection
core(TagEngine)/core(Supplier): wraps a ready engine (same parameters asTagTrailerDataContentBuilder).single(ZeroEchoSession): constructs a non-hybridSignatureContext.hybrid(ZeroEchoSession): constructs a hybridSignatureContextviaHybridSignatureContexts.
Context construction is in-memory. Checked I/O failures arise only when a built stream is attached or processed.
- Since:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classHelper entry for hybrid signature construction.static final classHelper entry for single-algorithm signature construction. -
Method Summary
Modifier and TypeMethodDescriptionbufferSize(int bytes) Sets the internal I/O buffer size used when stripping the trailer.build(boolean encrypt) Constructs and returns a newDataContentinstance based on the builder's current configuration.Core mode: wraps an engine factory.Core mode: wraps a fixed engine instance.flagInContext(CtxInterface ctx, Key<Boolean> verifyKey) Instead of throwing on mismatch, records the verification outcome into a context flag.hybrid(ZeroEchoSession session) Enters hybrid signature construction helpers.single(ZeroEchoSession session) Enters single-algorithm (non-hybrid) construction helpers.Configures verification to throw on mismatch (default verification behavior).
-
Method Details
-
core
Core mode: wraps a fixed engine instance.This is the direct signature-specialized equivalent of:
new TagTrailerDataContentBuilder<Signature>(engine).- Parameters:
engine- signature engine (typically aSignatureContext); must not benull- Returns:
- builder instance
- Throws:
NullPointerException- ifengineisnull- Since:
- 1.0
-
core
public static SignatureTrailerDataContentBuilder core(Supplier<? extends TagEngine<Signature>> engineFactory) Core mode: wraps an engine factory.This is the direct signature-specialized equivalent of:
new TagTrailerDataContentBuilder<Signature>(engineFactory).- Parameters:
engineFactory- engine factory; must not benull- Returns:
- builder instance
- Throws:
NullPointerException- ifengineFactoryisnull- Since:
- 1.0
-
single
Enters single-algorithm (non-hybrid) construction helpers.- Parameters:
session- active session used to create signature contexts- Returns:
- selector for creating signing/verifying builders
- Since:
- 1.0
-
hybrid
Enters hybrid signature construction helpers.- Parameters:
session- active session used to create signature contexts- Returns:
- selector for creating signing/verifying builders
- Since:
- 1.0
-
bufferSize
Sets the internal I/O buffer size used when stripping the trailer.- Parameters:
bytes- buffer size in bytes; must be at least 1- Returns:
- this builder for chaining
- Throws:
IllegalArgumentException- ifbytes < 1- Since:
- 1.0
-
throwOnMismatch
Configures verification to throw on mismatch (default verification behavior).- Returns:
- this builder for chaining
- Since:
- 1.0
-
flagInContext
Instead of throwing on mismatch, records the verification outcome into a context flag.- Parameters:
ctx- context instance to receive the flag; must not benullverifyKey- key under which theBooleanresult is recorded; must not benull- Returns:
- this builder for chaining
- Throws:
NullPointerException- ifctxorverifyKeyisnull- Since:
- 1.0
-
build
Description copied from interface:DataContentBuilderConstructs and returns a newDataContentinstance based on the builder's current configuration.- Specified by:
buildin interfaceDataContentBuilder<DataContent>- Parameters:
encrypt- whether the resultingDataContentshould be configured for encryption (true) or decryption (false). In encryption mode, additional headers or metadata may be inserted into the stream which must be retained for successful decryption.- Returns:
- the constructed
DataContentinstance
-