3 releases
Uses old Rust 2015
0.1.3 | Dec 31, 2015 |
---|---|
0.1.2 | Dec 30, 2015 |
0.1.1 | Dec 30, 2015 |
#26 in #encrypted
63 downloads per month
Used in great
61KB
1.5K
SLoC
Provides an interface to Rust Crypto for encrypting and decrypting files.
Read the docs for examples and usage.
lib.rs
:
This library provides an interface to Rust Crypto(1) for encrypting and decrypting files. It provides the following features:
-
A high-level configuration interface to specify various options
-
Generation and verification of HMACs(2) for the encrypted data.
In the future, this library may provide:
-
Support for different encryption methods or output formats.
-
Support for encryption libraries other than rust crypto
-
Support for arbitrary user-provided metadata that is included (encrypted) with the output file.
This library is on GitHub. Feel free to make feature suggestions in the issue tracker.
Example
use encryptfile as ef;
// Encrypt
let mut in_file = std::env::var("HOME").unwrap();
in_file.push_str("/.bash_history");
let mut c = ef::Config::new();
c.input_stream(ef::InputStream::File(in_file.to_owned()))
.output_stream(ef::OutputStream::File("/tmp/__encrypted_bash_history.ef".to_owned()))
.add_output_option(ef::OutputOption::AllowOverwrite)
.initialization_vector(ef::InitializationVector::GenerateFromRng)
.password(ef::PasswordType::Text("iloveyou".to_owned(), ef::scrypt_defaults()))
.encrypt();
let _ = ef::process(&c).map_err(|e| panic!("error encrypting: {:?}", e));
// Decrypt
let mut c = ef::Config::new();
c.input_stream(ef::InputStream::File("/tmp/__encrypted_bash_history.ef".to_owned()))
.output_stream(ef::OutputStream::File("/tmp/__encrypted_bash_history.txt".to_owned()))
.add_output_option(ef::OutputOption::AllowOverwrite)
.password(ef::PasswordType::Text("iloveyou".to_owned(), ef::PasswordKeyGenMethod::ReadFromFile))
.decrypt();
let _ = ef::process(&c).map_err(|e| panic!("error decrypting: {:?}", e));
Dependencies
~4MB
~53K SLoC