2 unstable releases
Uses old Rust 2015
0.2.0 | Sep 2, 2016 |
---|---|
0.1.0 | Aug 30, 2016 |
#2301 in Cryptography
24 downloads per month
Used in ykcryptsetup
39KB
919 lines
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();
}
Dependencies
~1.5MB
~36K SLoC