Commit Graph

64 Commits

Author SHA1 Message Date
83131c3e72 refactor(pki): make status authority transactional
Persist immutable status records and STATUS_OBJECT_RECORD content-owner
edges atomically through the transactional metadata store.

Remove the former status/by-id file authority and scan-derived content
retention while keeping CRL payloads external and publication as a
separate post-commit lifecycle.
2026-08-02 00:04:14 +02:00
c2112f58fc test(pki): align revocation fixtures with store authority
Rebuild revocation test credentials through the target staged-content
store and real credential persistence path.

Preserve strict foreign-store rejection while restoring full coverage
of revocation transitions, corruption handling, concurrency, and
durability semantics.
2026-08-01 22:29:30 +02:00
0a07dc6ee2 refactor(pki): normalize credential authority and snapshots
Make standalone Credential records the sole durable certificate-content
authority and replace embedded CaRecord credentials with stable
credential ID references.

Rework snapshot export and restore to stream certificate content,
mint target-store references, preserve dependency ordering, and reject
legacy embedded-credential and v2 persistence formats.

Validated:
- lib tests: 516/516
- FilesystemPkiStoreTest: 16/16
- PMD and JavaDoc pass
- app compilation passes
- only the 29 independently classified revocation fixture failures remain
2026-08-01 22:18:08 +02:00
aa89c09238 feat(pki): confine local private-key signing to lib
Move local key resolution and signing execution behind the lib-owned
KeyringSignatureExecutor boundary.

Ensure production PKI code operates only with KeyRef and never obtains,
stores, encodes, or exposes PrivateKey material. Preserve streaming,
cancellation, workflow persistence, and terminal outcome semantics.
2026-08-01 20:37:46 +02:00
08db857e05 feat(pki): migrate signing authority to transactional metadata
Atomically persist signing workflow records and SIGNING_OPERATION
content-owner edges through the transactional metadata store.

Use the canonical SigningSubmissionId directly as the MetadataKey,
remove the former current.bin and signing-specific .owners authority,
and recover pending signing operations only from consistent metadata
record/owner pairs.

Keep immutable staged payload and reference metadata external.

Validated:
- focused migration tests pass
- lib tests pass
- PMD and JavaDoc pass
- app compilation passes
- pki retains only the 31 independently classified credential and
  revocation failures
2026-08-01 17:58:16 +02:00
5420c19d08 wip(pki): checkpoint Phase A metadata foundation
Checkpoint the current pre-release Phase A work before production
persistence integration continues.

Includes the consolidated transactional metadata SPI, POSIX append-only
metadata log, recovery epochs, mutation codec, state reducer, internal
transaction engine, transactional adapter, staged-content foundations,
and the related current lib/pki changes.

Validated baseline:
- lib tests pass
- focused metadata tests pass
- PMD passes with zero findings
- JavaDoc passes
- app compilation passes
- pki retains exactly 31 independently classified failures:
  2 credential snapshot/model cases and 29 revocation fixture/reference
  cases

This is a work-in-progress safety checkpoint, not a release-ready
milestone.
2026-08-01 16:45:14 +02:00
369c626ed8 fix(ext): bound covert payload processing
Harden LSB extraction against untrusted lengths, insufficient carrier
capacity, truncated payloads, and unbounded stream consumption.

Validate JPEG/EXIF covert framing, configured slot capacity, duplicate
slots, Pack7 lengths, payload completeness, and the one MiB payload
limit.

Add focused boundary and malformed-input tests and document the
incubating JPEG parser trust boundary and accepted residual risk.
2026-07-31 00:09:33 +02:00
54c6c3dd47 fix(ext): harden Piwigo export transport
Enforce structurally validated HTTPS endpoints and direct multipart
uploads without generated shell scripts.

Prevent command and multipart-header injection, redact credentials,
clear temporary password copies, and add hostile-input regression
tests.

Correct stale export package JavaDoc references.
2026-07-30 23:18:22 +02:00
87c59ab7fd fix(lib): harden Pack7 long decoding
Bound Pack7 long decoding to ten input bytes and fail closed on
truncated, over-width, and overflowing encodings.

Add boundary, truncation, exact-consumption, and deterministic
bounded-read regression tests.

Closes original audit finding H5.
2026-07-30 22:33:46 +02:00
2d35e61466 refactor(lib): normalize source headers and close PMD findings 2026-07-30 21:33:30 +02:00
dedd16f584 chore(text): source code format 2026-07-30 20:28:43 +02:00
bc68e0433c chore(import): fix invalid imports 2026-07-30 20:26:14 +02:00
849c8c82cb security(pki): enforce configuration-driven CA profiles
* add versioned root and intermediate CA profile documents
* extend the strict profile schema with closed certificate kinds
* package canonical built-in root and intermediate profiles
* enforce immutable import and explicit activation for CA profiles
* bind CA credentials to exact profile ID, version, and canonical hash
* resolve active profiles for root and intermediate issuance
* validate issuer-controlled CA requests before backend execution
* enforce complete CA DER and extension postconditions
* reject inactive, mismatched, and malicious profile/backend inputs
* preserve historical credential bindings across profile activation changes
* add root and intermediate profile version-switch coverage

BREAKING CHANGE: root and intermediate CA issuance now requires an explicitly imported and activated versioned CA profile.
2026-07-30 20:14:11 +02:00
9e40e8b5a2 security(pki): enforce configuration-driven certificate profiles
* add strict versioned JSON profile documents and canonical serialization
* package validated built-in end-entity profile templates
* persist immutable profile versions with canonical hashes
* require explicit atomic profile activation
* resolve issuance profiles only from validated active store references
* enforce deny-by-default subject and SAN policies
* support typed DNS, IP, URI, and RFC822 SAN identities
* remove requester control over certificate serials and reserved fields
* bind issued credentials to exact profile ID, version, and hash
* enforce closed end-entity and CA credential profile-binding variants
* validate issued DER against the complete approved profile
* add real SAN issuance, CSR rejection, malicious-backend, lifecycle, snapshot, and redaction coverage

BREAKING CHANGE: replaces direct and mutable pre-release profile handling with strict JSON import,
immutable version persistence, explicit activation, and exact credential profile bindings.
2026-07-30 17:15:33 +02:00
f06b25fa39 security(pki): enforce authoritative revocation state 2026-07-30 10:11:26 +02:00
8b2f3df41f security(lib,storage): enforce single-use encryption contexts, encrypt keyring and harden key import 2026-07-29 23:18:22 +02:00
9bbcab7522 security(lib): enforce single-use encryption contexts 2026-07-29 17:28:32 +02:00
8af75a9508 security(pki): replace reflective persistence decoding with strict schemas 2026-07-29 16:33:37 +02:00
07e04e0eed security(pki): enforce proof gates and durable signing workflows 2026-07-29 14:20:21 +02:00
49dc080c65 refactor!: consolidate crypto architecture and security model
* make ZeroEchoSession the sole policy, audit, and runtime boundary
* replace combined key builders with operation-specific SPI and typed metadata
* remove obsolete pre-release compatibility APIs and global crypto operations
* finalize JCA agreement contexts and replace inheritance with composition
* harden secret lifecycle, key destruction, hybrid KEX, PBKDF2, and audit handling
* standardize PairSeq I/O and introduce immutable validated value types
* migrate app, ext, samples, and required pki integration points
* expand correctness, security, concurrency, and malformed-input coverage

BREAKING CHANGE: removes deprecated pre-release global configuration, legacy
context factories, combined key-builder contracts, String-based password APIs,
unchecked PairSeq writing, BlockGeometry public fields, and other compatibility
facades.
2026-07-28 19:20:30 +02:00
7319aca0db Explanation of Licenses 2026-06-07 13:17:02 +02:00
f2260eff73 Merge branch 'main' of https://gitea.egothor.org/Egothor/ZeroEcho
All checks were successful
Release / release (push) Successful in 41s
release@1.1.1
2026-06-03 21:14:33 +02:00
4a5e7b9c11 fix(vuln): bouncycastle security issue 2026-06-03 21:13:20 +02:00
14a7a940de fix(vuln): bouncycastle security issue 2026-06-03 21:02:35 +02:00
eca392007c chore: BSD-3 license 2026-06-03 18:45:31 +02:00
2333b01a3f fix(build): update Foojay toolchain resolver for Gradle 9
All checks were successful
Release / release (push) Successful in 1m16s
release@1.1.0
2026-06-03 11:46:07 +02:00
de55ea909f Integrate CredentialFrameworkProvider bootstrap SPI and harden provider config validation
feat: add SPI-based CredentialFrameworkProvider resolution to PkiBootstrap via ServiceLoader
feat: add PkiBootstrap.openCredentialFramework() for provider-driven credential framework initialization
feat: register BcX509CredentialFrameworkProvider in META-INF/services
feat: introduce ConfigurableProvider.validateConfig(ProviderConfig) as a standard provider-side validation hook
fix: move generic backendId consistency validation into the default ConfigurableProvider validation routine
fix: enforce provider-local configuration validation from allocate() so direct provider use remains safe outside bootstrap
fix: add provider-specific validateConfig implementations for bootstrap-managed providers based on consumed configuration keys
fix: report unknown provider configuration keys through provider-local JUL warning logs without exposing values
fix: fail fast on malformed consumed configuration values instead of silently falling back where invalid input would mask operator error
fix: extend PkiBootstrapTest to cover CredentialFrameworkProvider bootstrap path
fix: extend PkiBootstrapTest to cover async and crypto.workflow initialization paths whose prefixed properties are cleared in test setup
fix: add negative bootstrap/provider validation coverage for backend mismatch and invalid configured values
docs: expand JavaDoc and package-level documentation for CredentialFrameworkProvider bootstrap wiring, ServiceLoader usage, and configuration validation behavior
chore: keep PkiBootstrap independent from implementation-specific BC framework classes and preserve provider autonomy over validation and diagnostics

Closes #3 spent @2h
2026-04-06 01:51:15 +02:00
a66c115a80 chore: removal of the obsolete mockito-inline:5.2.0 2026-04-05 23:15:09 +02:00
e74e833c5b chore: extract shared classic-leg wiring in HybridKexBuilder
Extract duplicated classic-leg construction from
HybridKexBuilder.buildInitiator() and buildResponder()
into a private buildClassicLeg() helper with JavaDoc.

This keeps classic mode validation and context creation
in one place, reduces asymmetry risk between initiator
and responder paths, and preserves existing behavior.

Closes #18 spent @30m
2026-04-05 22:56:47 +02:00
14fbf31989 fix: replace CryptoAlgorithms audit wrap instanceof chain with Java 21
switch

Replace the AUDIT_MODE == WRAP dispatch in
zeroecho.core.CryptoAlgorithms#create(...) with an exhaustive Java 21
pattern switch over the sealed CryptoContext hierarchy. This removes the
repeated instanceof chain, keeps unchecked casts localized in a single
internal helper, and closes the missing audit-wrap gap for
AgreementContext.

Add focused JUnit 5 coverage for audited proxy wrapping using
Mockito-based tests for representative context interfaces and wrapper
lifecycle delegation.

Closes #20
Time-Spent: 45m
2026-04-05 22:17:14 +02:00
a4b9eeffe1 chore: restore canonical LICENSE filename 2026-04-01 23:09:44 +02:00
e235d0e2b5 chore: rename license temporarily 2026-04-01 23:09:26 +02:00
d1bdf7d9df Split integrations and export into ext module
feat: move integrations from lib to ext
feat: move content export from lib to ext
feat: rename affected packages for separate module distribution
chore: update Gradle module wiring
chore: adjust JPMS descriptors and dependencies
docs: update module structure documentation
2026-04-01 20:43:10 +02:00
354e9dd9bc Stabilize PKI core persistence, signing interop, and approval workflow
fix: harden FsCodec determinism and persisted type round-trips
fix: align CSR PoP verification with standards-compatible signature validation
fix: make async approval deny propagation deterministic in signing bus tests
chore: reduce IDE/Gradle drift by strengthening regression coverage
2026-03-24 17:36:12 +01:00
414e812150 Keyring naming cleanup and deprecation fix
chore: standardize keyring pub/priv naming
chore: prepare for deprecated assignment replacement
2026-03-22 14:30:16 +01:00
c922c02fd2 upgrade: gradle 9.4.0 2026-03-16 20:38:18 +01:00
adfa0b4b51 feat: add universal AsyncBus infrastructure
Introduce a generic asynchronous bus used for internal PKI workflows,
with resilient sweep support and symmetric primitive/wrapper type
compatibility for dispatch handling.

Signed-off-by: Leo Galambos <lg@hq.egothor.org>
2026-01-02 22:28:53 +01:00
e01d95f48e chore: PMD 1.20.0 adaptation
Signed-off-by: Leo Galambos <lg@hq.egothor.org>
2026-01-01 11:44:13 +01:00
969a846d95 fix: proxy object might be returned
Signed-off-by: Leo Galambos <lg@hq.egothor.org>
2026-01-01 11:42:13 +01:00
d2ec77b8e3 feat: introduce SignatureWorkflow SPI and zeroecho-lib implementation
- add SignatureWorkflow SPI for asynchronous sign/verify operations
- define audit-friendly, exception-free failure model
- introduce stable OperationStatus, State and OperationResult semantics
- document trust boundaries, lifecycle, and audit constraints in SPI
  JavaDoc
- add ZeroEchoLibSignatureWorkflow backed by KeyringStore and ZeroEcho
  lib
- enforce opaque KeyRef handling and provider-local parsing
- add deterministic detail codes and UNKNOWN_OPERATION handling
- integrate workflow provider into ServiceLoader bootstrap
- align PkiBootstrap logging and defaults with crypto workflow SPI
- add comprehensive JUnit tests for validation and status semantics

Signed-off-by: Leo Galambos <lg@hq.egothor.org>
2025-12-29 22:41:11 +01:00
0346c5b30f feat: refactor SPI/bootstrap to generic configurable providers
- Introduce a universal ConfigurableProvider/ProviderConfig abstraction
  for ServiceLoader-based components and align PKI bootstrapping
  utilities with it.
- Document deterministic provider selection, property-based
  configuration conventions, and security requirements (never log config
  values), including package-level documentation for spi, spi.store and
  spi.bootstrap.

fix: harden audit runtime, fix gzip scanning, add bounds and docs

- Fix FileAuditSink concatenated gzip scan by shielding underlying
  stream
- Use JUnit @TempDir for filesystem-backed tests
- Bound InMemoryAuditSink with deterministic ring buffer
- Add ServiceLoader smoke test and expand DefaultAuditService coverage
- Improve JavaDoc and logging across audit implementation

feat: add deterministic tests for PkiBootstrap with real SPI providers

- add JUnit 5 test suite for PkiBootstrap
- cover SPI selection for filesystem PkiStore and audit sinks
- use @TempDir for filesystem-backed providers
- register test ServiceLoader providers under src/test/resources
- ensure deterministic bootstrap behavior via system properties

Signed-off-by: Leo Galambos <lg@hq.egothor.org>
2025-12-29 02:09:07 +01:00
cab1eeefe7 feat: add filesystem-based PkiStore reference implementation
Introduce a deterministic filesystem-backed PkiStore implementation
under zeroecho.pki.impl.fs.

Key characteristics:
- write-once semantics for immutable objects with explicit failure on
  overwrite
- history tracking for mutable records with full audit trail
- atomic writes using NIO (temp + move) with best-effort durability
- strict snapshot export supporting time-travel reconstruction
- configurable history retention (ON_WRITE policy)
- no secrets logged; JUL-only diagnostics for anomalies

Includes comprehensive JUnit 5 tests validating:
- write-once enforcement
- history creation and overwrite semantics
- strict snapshot export (failure and positive selection cases)
- deterministic on-disk layout and structure

This implementation is intentionally non-public and serves as a
reference and validation baseline for future persistence backends.

Signed-off-by: Leo Galambos <lg@hq.egothor.org>
2025-12-28 01:15:46 +01:00
7673e7d82f feat: PKI module core design
Signed-off-by: Leo Galambos <lg@hq.egothor.org>
2025-12-27 21:38:32 +01:00
276ac91eb4 chore: replace apache-cli deprecated methods
Signed-off-by: Leo Galambos <lg@hq.egothor.org>
2025-12-27 16:55:28 +01:00
e82e0e57fb Merge hybrid cryptography support (KEX, derived keys, signatures)
This merge introduces the sdk.hybrid package with support for:
- hybrid key exchange (classic + post-quantum),
- hybrid-derived key injection for encryption and MAC builders,
- hybrid signature composition.

The implementation is additive at the SDK layer and does not modify
core cryptographic contracts.
2025-12-26 21:08:31 +01:00
300f40c283 feat: add hybrid-derived key injection
Extend HMAC metadata and builders to expose recommended key sizes and
enable safe derived-key injection without duplicating algorithm
configuration.

Key changes:
- Add HybridDerived utility for expanding hybrid KEX output and
  injecting purpose-separated keys, IVs/nonces and optional AAD into
  existing DataContent builders (AES-GCM, ChaCha, HMAC)
- Improve HmacSpec and HmacDataContentBuilder to expose recommended key
  material characteristics for derived use
- Refine HybridKexContexts to better support exporter-based derived
  workflows
- Add comprehensive unit tests for hybrid-derived functionality
- Add documented demo showing hybrid-derived AES-GCM encryption,
  including local (self-recipient) hybrid usage
- Introduce top-level sdk.hybrid package documentation and derived
  subpackage Javadoc

All changes are additive at the SDK layer; core cryptographic contracts
remain unchanged.

Signed-off-by: Leo Galambos <lg@hq.egothor.org>
2025-12-26 21:00:01 +01:00
55da24735f feat: add hybrid key exchange framework
Introduce a complete SDK-level hybrid KEX framework combining classic
(DH/ECDH/XDH) and post-quantum (KEM adapter) agreement contexts.

Key additions:
- HybridKexContext and HybridKexContexts for hybrid handshake
  orchestration over existing AgreementContext and
  MessageAgreementContext APIs
- HybridKexProfile, HybridKexTranscript and HybridKexExporter providing
  HKDF-based key derivation, transcript binding and key schedule support
- HybridKexPolicy for optional security strength and output-length
  gating
- HybridKexBuilder offering a fluent, professional API for constructing
  CLASSIC_AGREEMENT + KEM_ADAPTER and PAIR_MESSAGE + KEM_ADAPTER
  variants
- Comprehensive JUnit tests and documented demo illustrating both hybrid
  modes

No changes to core cryptographic APIs; all hybrid logic is implemented
as additive functionality in the SDK layer.

Signed-off-by: Leo Galambos <lg@hq.egothor.org>
2025-12-26 17:48:39 +01:00
34eca245f0 feat: add message-oriented agreement contexts for DH, ECDH and XDH
Introduce GenericJcaMessageAgreementContext and KeyPairKey to support
message-based key agreement without breaking existing AgreementContext
capabilities.

Key changes:
- Add KeyPairKey wrapper to carry KeyPair through capability dispatch.
- Introduce GenericJcaMessageAgreementContext implementing
  MessageAgreementContext, mapping the protocol message to an
  SPKI-encoded public key.
- Extend DH, ECDH and XDH algorithms with an additional
  MessageAgreementContext capability while preserving existing
  PrivateKey-based agreement usage.
- Improve core agreement tests to cover CLASSIC_AGREEMENT, PAIR_MESSAGE
  and KEM_ADAPTER variants with explicit branch identification.
- Add demo samples illustrating practical usage patterns for ML-KEM and
  XDH agreement variants, including lifecycle and resource management
  guidance.

This change adds capabilities by extension rather than replacement and
keeps existing APIs and behaviors fully backward compatible.

Signed-off-by: Leo Galambos <lg@hq.egothor.org>
2025-12-26 14:56:47 +01:00
7f79082adc feat: introduce hybrid signature framework and signature trailer builder
Add a complete hybrid signature implementation combining two independent
signature algorithms with AND/OR verification semantics, designed for
streaming pipelines.

Key changes:
- Add zeroecho.sdk.hybrid.signature package with core hybrid signature
  abstractions (HybridSignatureContext, HybridSignatureProfile,
  factories, predicates, and package documentation).
- Introduce SignatureTrailerDataContentBuilder as a
  signature-specialized replacement for
  TagTrailerDataContentBuilder<Signature>, supporting
  core, single-algorithm, and hybrid signature construction.
- Extend sdk.builders package documentation to reference the new
  signature trailer builder and newly added PQC signature builders.
- Adjust TagEngineBuilder where required to support hybrid verification
  integration.
- Update JUL configuration to accommodate hybrid signature diagnostics
  without leaking sensitive material.

Tests and samples:
- Add comprehensive JUnit 5 tests covering hybrid signatures in all
  supported modes, including positive and negative cases.
- Add a dedicated sample demonstrating hybrid signing combined with AES
  encryption (StE and EtS).
- Update existing signing samples to reflect the new signature trailer
  builder.

The changes introduce a unified, extensible hybrid signature model
without breaking existing core APIs or pipeline composition patterns.

Signed-off-by: Leo Galambos <lg@hq.egothor.org>
2025-12-26 02:01:29 +01:00
174d63dff4 feat: add ML-DSA and SLH-DSA streaming builders
chore: update alg package docs

Introduce DataContentBuilder implementations for ML-DSA and SLH-DSA
aligned with the existing SphincsPlus builder, and update the
builders.alg package Javadoc to document the newly supported
post-quantum signature schemes.

Signed-off-by: Leo Galambos <lg@hq.egothor.org>
2025-12-25 19:24:39 +01:00