Crate dryoc[][src]

dryoc: Don’t Roll Your Own Crypto™️

A pure-Rust implementation of libsodium, intended to be 100% compatible with a mostly interchangeable API, and have limited dependencies.

This library includes both a classic API, which is very similar to the original libsodium API, and Rustaceous API with Rust-specific features. Both APIs can be used together interchangeably, according to your preferences. The Rustaceous API is a wrapper around the underlying classic API.

It’s recommended that you use the Rustaceous API unless you have strong feelings about using the Classic API.

To get started with the Rustaceous API, refer to dryocbox and dryocsecretbox.

To get started, with the classic (libsodium) API, refer to crypto_box and crypto_secretbox.

Using Serde

This crate includes optional Serde support which can be enabled with the serde feature flag. When using text-based formats, such as JSON or YAML, it’s recommended you enable the base64 feature as well, which encodes binary fields as base64. For binary formats, this may not be necessary if they already include optimized storage for binary types.

Security notes

This crate has NOT been audited, but some of the underlying implementations have received some auditing, such as the poly1305 crate. Notably, only the non-AVX2 backend has been audited. Thus, don’t enable AVX2 if you’re paranoid, and avoid non-ARM and non-Intel microarchitectures.

Modules

ciphertext

Ciphertext wrapper

constants

Constant value definitions

crypto_box

Authenticated public-key cryptography functions

crypto_core

Core cryptography functions

crypto_hash

Hash functions

crypto_secretbox

Authenticated encryption functions

dryocbox

Public-key authenticated encryption

dryocsecretbox

Secret-key authenticated encryption

keypair

Public-key tools

message

Message wrapper

nonce

Nonce wrapper

prelude

The dryoc prelude

rng

Random number generation utilities

secretboxkey

Secret-key box key wrapper

traits

Public traits