Expand description
§Hybrid public key encryption with algorithms dispatched at runtime
This crate provides a generic-free interface to the hpke
crate, a Rust implementation of the hybrid public key
encryption
scheme. If you know the specific (aead, kdf, kem) triple at compile
time, you should use the hpke crate directly.
Currently, this crate only exposes interfaces for the Base mode described in the HPKE specification, and within base mode, only stateless single-shot message encryption/decryption, as defined in Section 6, “Single-Shot APIs”.
The algorithms supported in this crate and their codepoints are as described in the HPKE specification and draft-ietf-hpke-pq.
§Available cargo features:
hpke-dispatch’s cargo features are designed to align directly with those of hpke. See
that crate’s documentation for discussion of how to selectively enable algorithms.
hpke-dispatch defines the following additional features:
-
algo-all: enables all aead, kdf, and kem algorithms. Enabled by default.
-
aead-all: Enables
aesandchachaalgorithm features. Enabled by default. -
kdf-all: Enables
hkdfsha2andshakealgorithm features. Enabled by default. -
kem-all: Enables
x25519,nistpandmlkemalgorithm features. Enabled by default. -
serde: Enables derived serde serialization and deserialization for all public structs and enums. Disabled by default.
§Example feature usage:
To depend on this crate with all algorithms, use default features.
To depend on this crate with only AES, NIST curves, SHA-2 and Serde enabled, use
default-features = false, features = ["aes", "hkdfsha2", "nistp", "serde"].
Structs§
- Config
- Configuration for crate interfaces.
- Encapped
KeyAnd Ciphertext - Encapsulated key and ciphertext.
- IdLookup
Error - A simple error type for failed id lookups
- Keypair
- An encoded keypair
Enums§
- Aead
- An authenticated encryption with additional data encryption function, as per RFC9180§7.3.
- Hpke
Error - Describes things that can go wrong in the HPKE protocol
- Kdf
- A key derivation function used in HPKE.
- Kem
- An asymmetric key encapsulation mechanism.
Constants§
- AEAD_
ALL - An iterable slice of
Aeadvariants - KDF_ALL
- An iterable slice of
Kdfvariants - KEM_ALL
- An iterable slice of
Kemvariants
Functions§
- base_
mode_ open - Single-shot HPKE ciphertext opening.
- base_
mode_ seal - Single-shot HPKE ciphertext sealing.
- gen_
keypair - generate a Keypair for the provided asymmetric key encapsulation mechanism (
Kem)