#encryption-decryption #decryption #encryption #file #format

encryptfile

Provides an interface to Rust Crypto for encrypting and decrypting files

3 releases

Uses old Rust 2015

0.1.3 Dec 31, 2015
0.1.2 Dec 30, 2015
0.1.1 Dec 30, 2015

#27 in #encrypted

Download history 14/week @ 2024-02-18 40/week @ 2024-02-25 16/week @ 2024-03-03 16/week @ 2024-03-10 11/week @ 2024-03-17 17/week @ 2024-03-24 81/week @ 2024-03-31 6/week @ 2024-04-07 5/week @ 2024-04-14 37/week @ 2024-04-21 7/week @ 2024-04-28 13/week @ 2024-05-05 45/week @ 2024-05-12 16/week @ 2024-05-19

83 downloads per month
Used in great

MIT license

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:

  1. A high-level configuration interface to specify various options

  2. Generation and verification of HMACs(2) for the encrypted data.

In the future, this library may provide:

  1. Support for different encryption methods or output formats.

  2. Support for encryption libraries other than rust crypto

  3. 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