Package zeroecho.core.context
package zeroecho.core.context
Abstractions for cryptographic operation contexts.
This package defines the context layer that models active cryptographic operations. A context represents a live, single-use operation bound to a key and an optional specification. Contexts cover both stream-oriented transforms (for example, encryption, MAC, signatures, digests) and message-oriented exchanges (for example, key agreement and key encapsulation).
Responsibilities
- Provide a stable set of operation-specific interfaces that algorithms implement when producing runnable contexts.
- Unify lifecycle concepts across operations: creation by an algorithm for
a concrete
KeyUsage, execution of the operation, and explicit closure viaCryptoContext.close(). - Support both streaming and non-streaming styles without leaking provider details into application code.
Context kinds
DigestContext- unkeyed digests and extendable-output functions.MacContext- message authentication codes producing or verifying fixed-length tags.EncryptionContext- symmetric or asymmetric encryption and decryption over byte streams.SignatureContext- streaming digital signatures for sign and verify roles.AgreementContext- key agreement deriving a shared secret from a local private key and a peer public key.MessageAgreementContext- agreement modeled as an exchange of explicit peer messages.KemContext- key encapsulation mechanisms for encapsulate/decapsulate workflows.
Lifecycle and safety
- Contexts are typically single-use and not thread-safe; create one per pipeline or exchange.
- Implementations should avoid retaining sensitive byte arrays; callers are expected to apply a KDF to shared secrets and clear temporary material promptly.
- Unkeyed operations may use
NullKey.INSTANCEwhere an API requires a key reference.
- Since:
- 1.0
-
ClassDescriptionContext for performing key agreement protocols using a private key and a peer's public key.Common interface for all cryptographic operation contexts.Context for computing unkeyed message digests and extendable-output functions (XOFs) in streaming pipelines.Context for performing encryption or decryption in streaming pipelines.Context for performing key encapsulation and decapsulation (KEM) operations.Encapsulation result holding both ciphertext and shared secret.Context for computing message authentication codes (MACs) in streaming pipelines.Extension of
AgreementContextfor message-based key agreement protocols.Context for streaming digital signature operations in pull-based pipelines.