Skip to main content

Module dispatch

Module dispatch 

Source
Expand description

Algorithm-selected dispatch: keygen, sign/verify, key agreement, KEM, AEAD, hashing, and multikey binding routed by an core::Algorithm selector.

Structs§

AeadParams
Borrowed AEAD inputs. Key and nonce lengths are validated by the selected algorithm’s typed constructors at dispatch time, so a wrong length fails closed with a typed error instead of being truncated or padded.
GeneratedKeypair
A generated keypair together with the multikey-encoded public key.
MacParams
Borrowed HMAC inputs. The selected algorithm validates key and tag lengths before authenticating so callers cannot accidentally compare truncated tags.

Enums§

AlgorithmError
Error returned by algorithm dispatch operations.

Functions§

aead_decrypt
Decrypt and authenticate ciphertext || tag with the selected AEAD. The returned plaintext is zeroized on drop.
aead_encrypt
Encrypt plaintext with the selected AEAD. Returns ciphertext || tag.
derive_shared_secret
Derive a Diffie–Hellman shared secret. The returned secret zeroizes on drop.
generate_keypair
Generate a raw keypair for the given algorithm.
generate_multikey_keypair
Generate a keypair and multikey-encode the public key
hash_digest
Compute a digest using the selected hash algorithm.
kem_decapsulate
Decapsulate a KEM ciphertext. The returned shared secret zeroizes on drop.
kem_encapsulate
Returns (shared_secret, ciphertext); the shared secret zeroizes on drop.
mac_authenticate
Computes a MAC tag using the selected MAC algorithm.
mac_verify
Verifies a MAC tag using the selected MAC algorithm.
public_key_to_multikey
Multicodec/multikey-encode a public key, canonicalizing P-256 to its compressed SEC1 form. Returns the z-prefixed multikey string.
sign
Sign msg with secret under the selected signature algorithm, returning the detached signature bytes.
validate_verification_method_multikey
Structural validation of a typed public-key binding.
verify
Verify a detached signature.