cryptsetup 0.2.0

Full bindings to libcryptsetup.
Documentation

With a block device named /dev/sdc1, here's how to format it and add a password.

fn format() {

    let mut dev = CryptDevice::init(&TEST_DEVICE).unwrap();
    println!("device initialized {:?}", dev.get_device_name());

    dev.format(
        Parameters::Luks1 { hash: Hash::Sha1, data_alignment: 0, data_device: None },
        Cipher::AesXts { iv: Iv::Plain, bits: 128 },
        None,
        None
    ).unwrap();

    println!("formatted");
    dev.keyslot_add_by_volume_key(None, None, b"foo").unwrap();

    dev.keyslot_add_by_passphrase(None, b"foo", b"blabla").unwrap();
}