Skip to main content

Crate nacl_sealed_box

Crate nacl_sealed_box 

Source
Expand description

Minimal libsodium-compatible sealed boxes using the fixed NaCl XSalsa20-Poly1305 crypto_box suite.

Sealing uses caller-supplied cryptographic randomness. Authenticated opening returns a redacted, zeroizing plaintext owner.

§Features

No feature is enabled by default. The optional getrandom feature adds only the seal convenience, which delegates to seal_with_rng with the operating-system generator and never falls back to a seeded generator.

The default set stays empty on purpose: the operating-system generator has no bare-metal backend and needs a consumer-enabled backend on WebAssembly, so enabling it by default would remove targets from every dependent.

§Supported targets

The library is no_std and needs only alloc; every public operation allocates, so allocation is not optional.

With optional features disabled, continuous integration compiles the library for thumbv7em-none-eabi, wasm32-unknown-unknown, and x86_64-unknown-linux-musl, and runs the complete test suite on x86_64-unknown-linux-gnu. Compiling is the claim those targets carry; the suite itself is executed only on host targets.

The getrandom feature narrows that set. It cannot build for thumbv7em-none-eabi without a custom backend, and on wasm32-unknown-unknown the final binary must also enable getrandom/wasm_js.

Structs§

Plaintext
Authenticated recovered plaintext with redacted formatting and drop cleanup.
PublicKey
A validated, canonical X25519 recipient public key.
SecretKey
An owned X25519 recipient secret key.

Enums§

Error
Errors returned by sealed-box key and message operations.

Constants§

PUBLIC_KEY_SIZE
Size in bytes of an X25519 recipient public key.
SEAL_OVERHEAD
Number of bytes added to a plaintext by the sealed-box wire format.
SECRET_KEY_SIZE
Size in bytes of an X25519 recipient secret key.

Functions§

seal
Seals plaintext for recipient using the operating-system generator.
seal_with_rng
Seals plaintext for recipient using caller-supplied cryptographic randomness.
unseal
Authenticates and opens ciphertext for recipient.