Expand description
Algorithm dispatch and structural validation.
This crate is the runtime seam between an Algorithm
selector and the concrete primitive that implements it. Given an
algorithm value it routes keygen, sign/verify, key agreement, KEM
encapsulate/decapsulate, AEAD, and hashing to the matching primitive
adapter, and it binds public keys to their multicodec/multikey
encodings.
Two safety properties are enforced here rather than left to callers:
verify fails closed — an invalid signature is an
AlgorithmError::SignatureInvalid, never Ok(false) — and every
secret returned (generated private keys, shared secrets, decapsulated
secrets) is carried in a zeroizing wrapper. Length and key-shape checks are
performed by the selected primitive’s typed constructors and are exercised
by dispatch-level negative tests so algorithm routing cannot silently
truncate, pad, or reinterpret caller bytes.
Constant-time behavior for authentication comparisons is inherited from the wrapped primitive crates. Dispatch does not reimplement tag, MAC, or signature comparison logic; it routes to the primitive verifier and maps the verifier’s typed failure into this crate’s fail-closed result.
Re-exports§
pub use error::AlgorithmError;pub use traits::AeadParams;pub use traits::MacParams;pub use hash::hash_digest;pub use mac::mac_authenticate;pub use mac::mac_verify;pub use registry::aead_decrypt;pub use registry::aead_encrypt;pub use registry::generate_keypair;pub use registry::kem_decapsulate;pub use registry::kem_encapsulate;pub use registry::sign;pub use registry::verify;pub use keypair::generate_multikey_keypair;pub use keypair::GeneratedKeypair;pub use multikey::public_key_to_multikey;pub use validation::validate_verification_method_multikey;
Modules§
- algorithms
- Per-algorithm adapters wiring selectors to concrete primitives.
- error
- Error type returned by dispatch operations.
- hash
- Hashing dispatch.
- keypair
- Keypair generation with multikey-encoded public keys.
- mac
- Message authentication code dispatch.
- multikey
- Multicodec/multikey encoding of public keys.
- registry
- Runtime dispatch entry points for sign/verify, key agreement, KEM, and AEAD.
- traits
- Adapter traits implemented by each algorithm primitive.
- validation
- Structural validation of verification-method multikeys.