Skip to main content

veracrypt/
lib.rs

1//! # veracrypt-core — pure-Rust VeraCrypt/TrueCrypt reader and decryptor
2//!
3//! Brute the volume header's PRF + cipher from a password, recover the master
4//! key, and decrypt the data area. Panic-free and `forbid(unsafe)`; every crypto
5//! primitive is an audited RustCrypto crate.
6//!
7//! ```no_run
8//! use std::fs::File;
9//! let mut vol = veracrypt::VeraVolume::unlock_with_password(
10//!     File::open("container.vc")?,
11//!     b"passphrase",
12//! )?;
13//! let mut first = [0u8; 512];
14//! vol.read_at(0, &mut first)?;
15//! # Ok::<(), Box<dyn std::error::Error>>(())
16//! ```
17//!
18//! Correctness is validated against `cryptsetup --veracrypt` on a real VeraCrypt
19//! volume with a published password (Tier-1); see `docs/validation.md`.
20
21#![forbid(unsafe_code)]
22#![cfg_attr(
23    test,
24    allow(
25        clippy::unwrap_used,
26        clippy::expect_used,
27        clippy::trivially_copy_pass_by_ref,
28        clippy::seek_from_current
29    )
30)]
31
32mod crypto;
33mod error;
34mod header;
35#[cfg(feature = "vfs")]
36pub mod vfs;
37mod volume;
38
39pub use crypto::{Cipher, Prf};
40pub use error::{Result, VeraError};
41pub use header::{Flavor, VeraHeader};
42pub use volume::{DecryptedVolume, VeraVolume, VolumeInfo};