The server-side code is written in Python using the Flask microframework. The server is responsible for verifying the password and providing the decryption key to the client.
- Flask
- json
- Start the server by running
python app.py
- The server will listen on
http://localhost:8000/
by default. (Better host it somewhere) - The server has 2 routes:
/r
for password verification/upload_key
for uploading the encryption key
- The server expects a JSON object with the following fields:
user_id
: the unique identifier of the clientpassword
: the password to verifykey
: the encryption key (for/upload_key
route)
- The server will return a JSON object with the following fields:
key
: the decryption key (if the password is correct)error
: error message (if the password is incorrect)
The client code encrypts files on the specified directory. It communicates with the server to verify the password and upload the encryption key.
- cryptography
- requests
- Edit
password_verification_url
&key_upload_url
variable with your own URL in src/main.py - Run
python main.py
- The script will prompt for a password
- The script will encrypt all files in the specified directory (
/path/to/directory
by default) - The script will upload the encryption key to the server
- To decrypt the files, run the script again and enter the correct password
- Any improvement to the program is appreciated, happy coding! :)