This is a Rust-based command-line tool that encrypts files using PGP (Pretty Good Privacy). It allows users to encrypt files from a specified input directory and save the encrypted versions to an output directory. The tool leverages the sequoia-openpgp
crate for encryption and supports public key-based encryption.
- Encrypts all files in a given input folder
- Outputs encrypted files to a specified directory
- Supports public key encryption using the
sequoia-openpgp
crate - Maintains relative directory structure in the output folder
Clone the repository and navigate to the project directory:
git clone https://github.com/akoken/pgp-encryption.git
cd pgp-encryption
Then, build the project:
cargo build --release
Run the tool using the following command:
./target/release/pgp-encryption -f <input_folder> -o <output_folder> -k <public_key_file>
-f, --folder
: Input folder containing files to encrypt-o, --output
: Output folder where encrypted files will be stored-k, --key
: Path to the public key file used for encryption
./target/release/pgp-encryption -f ./documents -o ./encrypted -k public-key.asc
To compile the project manually, run:
cargo build --release
This will create an optimized binary in the target/release
directory.
The project relies on the following Rust crates:
sequoia-openpgp
for PGP encryptionwalkdir
for directory traversalclap
for command-line argument parsing
If an error occurs, the program will output an error message and return an appropriate exit code:
1
: Invalid input2
: Public key error3
: Encryption failure4
: I/O error