Class Tag
java.lang.Object
zeroecho.Tag
CLI entry point for producing and verifying trailer tags based on digital
signatures or digests.
Overview
This class wires command line options to content-processing pipelines that either append a tag (produce mode) or validate and strip a tag (verify mode). The tag can be a digital signature or a message digest, depending on the selected type and algorithm.Usage
ZeroEcho -T --type signature --mode produce --alg Ed25519 \
--ks keys.txt --priv my-signing-key --in file.bin --out file.tagged
ZeroEcho -T --type signature --mode verify --alg Ed25519 \
--ks keys.txt --pub my-verify-key --in file.tagged --out file.bin
ZeroEcho -T --type digest --mode produce --alg SHA-256 \
--in file.bin --out file.tagged
ZeroEcho -T --type digest --mode verify --alg SHA-256 \
--in file.tagged --out file.bin
# Use "-" to read from STDIN or write to STDOUT:
ZeroEcho -T --type digest --mode produce --alg SHA-256 --in - --out -
Notes
The signature mode requires a keyring file. In produce mode a private key is required, while in verify mode a public key is required. Digest mode does not require keys. A non-zero exit status indicates a verification mismatch or input errors.-
Method Summary
Modifier and TypeMethodDescriptionstatic intParses CLI arguments and executes produce or verify operation for signature or digest tags.static intmain(String[] args, org.apache.commons.cli.Options root, KeyringUnlockProvider unlockProvider) Executes the command with an explicit keyring unlock source.
-
Method Details
-
main
public static int main(String[] args, org.apache.commons.cli.Options root) throws org.apache.commons.cli.ParseException, IOException, GeneralSecurityException Parses CLI arguments and executes produce or verify operation for signature or digest tags.Behavior
The method validates required options, constructs the appropriate processing pipeline, and streams data from the input to the output while producing or verifying the trailing tag. On verification mismatch, it returns a non-zero exit code and attempts to remove a corrupted output file when applicable.- Parameters:
args- the command line arguments that follow-Troot- the options container to which this method appends its own options before parsing- Returns:
- process exit code:
0on success,1on verification mismatch or I/O error during verification,2on invalid arguments or unsupported options - Throws:
org.apache.commons.cli.ParseException- if CLI parsing failsIOException- if an I/O error occurs while reading or writing streamsGeneralSecurityException- if a cryptographic error occurs during signature or digest processing
-
main
public static int main(String[] args, org.apache.commons.cli.Options root, KeyringUnlockProvider unlockProvider) throws org.apache.commons.cli.ParseException, IOException, GeneralSecurityException Executes the command with an explicit keyring unlock source.- Parameters:
args- command argumentsroot- root optionsunlockProvider- keyring password provider- Returns:
- process exit code
- Throws:
org.apache.commons.cli.ParseException- if parsing failsIOException- if I/O failsGeneralSecurityException- if cryptographic processing fails
-