Package zeroecho.core.storage


package zeroecho.core.storage
Encrypted local software-keyring storage.

KeyringStore binds an unlocked store to one filesystem path and holds exclusive process-lifetime ownership until close. It wraps one random store master key with PBKDF2-HMAC-SHA-256 and AES-256-GCM, encrypts every entry independently, and authenticates the ordered entry manifest. Mutations use owner-only temporary files and atomic replacement.

Nonce-reservation authentication is cryptographically separated from AES entry and manifest encryption. A dedicated 256-bit MAC key is derived with HKDF-HMAC-SHA-256 from the store master key, canonical binary store UUID, and fixed nonce-reservation domain. It is never persisted, remains owned by the open store, and is destroyed on close. Only the current sidecar version is accepted.

Unlock passwords are destroyable, transfer ownership to the receiver, and are destroyed immediately after the master key is unwrapped. The unlocked store retains the master key, its domain-separated nonce-reservation MAC key, and encrypted entry records; closing the store clears this material. The store requires a POSIX filesystem on which owner-only permissions can be verified. A directory-force failure after atomic replacement makes the open instance unusable until close and authenticated reopen resolves which complete image is current. Non-exportable keys must remain behind an external provider reference.

Only the current binary format is accepted. Earlier plaintext development formats are rejected without migration. Persisted input contains no Java class or provider names and cannot trigger runtime class loading. Import specifications are selected from a closed mapping of canonical ZeroEcho algorithm, key kind, standard encoding, and (only for HMAC) one of the explicit SHA-256, SHA-384, or SHA-512 variants. Standard encodings are reconstructed through the current runtime's canonical importer; the originating JCA provider identity is not persisted or guaranteed. Keys that are provider-bound, non-exportable, or not canonically reconstructable must remain behind an external provider reference.

Since:
1.0