A two-file dependent encryption mechanism
chaincrypt implements a secure encryption mechanism where two files are encrypted in a way that they are mutually dependent for decryption. Each encrypted file contains part of the key required to decrypt the other, ensuring that both files must be present to access the original data.
How It Works:
-
A master key is randomly generated and split into two parts: key1 and key2.
-
File 1 is encrypted using key1, and File 2 is encrypted using key2.
-
Each encrypted file contains:
-
An IV (Initialization Vector)
-
The counterpart decryption key (key2 in File 1 and key1 in File 2)
-
The encrypted content
- During decryption, both files are required to retrieve the necessary keys and reconstruct the original data.
How to Run:
- Create two files in root dir:
- Example:
bit.txt and coin.txt
- Run encrypt.rs to encrypt your files:
cargo run --bin encrypt
- Run decrypt.rs to decrypt your files:
cargo run --bin decrypt