Crate false_bottom

Source
Expand description

§Usage

False Bottom is a deniable encryption scheme.
Unlike traditional encryption algorithms that map a given plaintext to ciphertext, False Bottom works by “adding” messages to an existing ciphertext.
As such, the initial ciphertext and the keybase are generated from random data.
The ciphertext then grows as messages are added whereas the keybase is fixed after initialization and is used to generate message specific keys for the ciphertext.
The parameters for the init() function determine the size (in number of blocks) of the initial ciphertext and keybase respectively.
Type aliases Fb128, Fb256 and Fb512 are provided to pick a block size.

§Cipher Initialization:

use false_bottom::{FalseBottom, Fb128};
// Initialize 15 blocks of ciphertext and 12 blocks of keybase with a block size of 128 bits.
let fb = Fb128::init(15, 12);

§Adding Messages:

Multiple messages can be added using the add() method.
This method returns an object FbKey that represents the message specific key for this message.
Only this key can decrypt the added message.

let msg = "Hello World!";
let key = fb.add(msg.as_bytes());

§Decryption:

The decrypt() method returns the message that corresponds to the provided FbKey.

let decrypted = fb.decrypt(&key).unwrap();

An example has been provided here.

§Import and Export

Available formats: Raw bytes and Base64 encoded.

§Raw Bytes:

The Encode trait provides methods for export and import of data.

use false_bottom::{Encode, FalseBottom, Fb128, FbError, FbKey};
// Exporting
let (ciphertext_bytes, keybase_bytes) = fb.to_bytes();
let key_bytes = key.to_bytes();
// Importing
let fb_imported = Fb128::from_bytes(&ciphertext_bytes, &keybase_bytes)?;
let key_imported = FbKey::from_bytes(&key_bytes)?;
§Base64 Encoded:

The feature base64 needs to be enabled in your Cargo.toml.

use false_bottom::{Encode, FalseBottom, Fb128, FbError, FbKey};
// Exporting
let (ciphertext_base64, keybase_base64) = fb.to_base64();
let key_base64 = key.to_base64();
// Importing
let fb_imported = Fb128::from_base64(&ciphertext_base64, &keybase_base64)?;
let key_imported = FbKey::from_base64(&key_base64)?;

An example has been provided here.

Structs§

FbKey
An object that represents a message specific key.
FbObj

Enums§

FbError
Enum representing all the possible errors in this crate.

Traits§

Encode
Provides methods to encode and decode data to and from several formats.
FalseBottom
The main interface to the False Bottom algorithm.

Type Aliases§

Fb128
An FbObj with block size of 128 bits.
Fb256
An FbObj with a block size of 256 bits.
Fb512
An FbObj with a block size of 512 bits.