Final project for Algorithm
Algorithm/s used: RSA Algorithm + AES Symmetric Encryption Algorithm
This is a CustomTkinter-based application that uses envelope encryption to encrypt and decrypt files using an AES key generated from the Fernet module, and then encrypt/decrypt that key using RSA. The algorithm here was manually implemented without the use of any external modules like Python's
import rsa module. Regardless, the implementation still works exactly as what the typical RSA public and private keys do in other applications, albeit in a slightly different manner.
Voidlock uses a custom file format to store the generated keys, namely public.voidlock and private.voidlock, and are further stored in a directory called .lock. These keys are stored in plaintext, with the exponent and the modulus separated by a comma (no whitespaces in-between).
Voidlock uses a special file format .void to store both the encrypted key and the actual encrypted file content, along with some metadata about the file extension. Essentially, the flow is:
Upload file to be encrypted ->
Get file extension ->
Generate session key using Fernet ->
Encrypt file contents using session key ->
Encrypt session key using RSA public key ->
Output all contents in .void file
Voidlock reads the .void file to decrypt the session key using the private RSA key, and which then decrypts the file contents and writes them into a file with the correct extension. The flow is:
Upload .void file ->
Read metadata and main contents ->
Decrypt session key using private key ->
Decrypt file contents using the session key ->
Output original contents into a file with extension from metadata
To use Voidlock for your own purposes:
Clone the repository into your local machine and cd inside
git clone https://github.com/sceraphine/Algorithm_Final_Project/
cd Algorithm_Final_Project/
Configure your virtual environment
python -m venv .venv
Activate your virtual environment
.venv\Scripts\activate (Windows)
source .venv/bin/activate (MacOS/Linux)
Install dependencies
pip install -r requirements.txt
Run the app
python main.py