Skip to content

sghebrab/GOST_WebService

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GOST_WebService

This simple self-hosted website lets you enjoy the experience of encrypting and decrypting messages using the GOST symmetric block cipher. The idea is very simple: the website is consists of 2 main tabs, one for encryption and the other for decryption. In each tab, the website will ask you to fill in the needed fields; if you don't fill them, then it won't proceed until you do it.

Encryption

The first tab is used for encryption. The required fields are:

    Operating mode (between ECB, CBC, OFB, CFB and CTR, default is CBC);
    The message to encrypt (A.K.A. plaintext);
    The password;
    Wether you want to choose the salt yourself or you want a random one.

If you choose to pick the salt yourself, then another input will appear for you to fill in.

Pushing the "Encrypt" button will take you to another page containing a resume of your choices, plus the ciphertext produced by the program.

Decryption

The second tab is pretty similar to the first one, but instead of performing encryption it performs decryption. Again, the required fields are:

    Operation mode (between ECB, CBC, OFB, CFB and CTR);
    The ciphertext (in hex form);
    The password;
    The salt;
    The IV (for any operating mode other than ECB).

After pushing the "Decrypt" button you'll be redirected to another page containing a resume of the data you typed in, plus the decrypted message.

Project organization:

  1. Main dir: it contains the GOST.py library which allows you to encrypt and decrypt messages. The main file is used to make the web server run;
  2. Templates dir: contains the HTML files. Index is of course the homepage, while the other ones' purpose can be guessed easily;
  3. Static dir: it contains favicons and JS scripts, plus some CSS styling;

How to

  1. Clone the repo on your PC;
  2. Create a virtual environment and install required packages from requirements.txt;
  3. Compile the C file GOST.c into a shared library object named GOST.so;
  4. Run the main Flask app from CLI.

Create the shared library

To compile the C file to make the shared library object, you can use the following commands from inside the program's directory:

gcc -c -fPIC GOST.c -o GOST.o
gcc -shared GOST.o -o GOST.so
rm GOST.o

Run the Flask app

To run the app, you can use the following commands from inside the program's directory:

. venv/bin/activate
export FLASK_APP=main
export FLASK_DEBUG=0
export PYTHONWARNINGS="ignore:Unverified HTTPS request"
flask run --host="0.0.0.0" --port=8080 --cert=gost.pem --key=gost.key
deactivate

About

A self-hosted Flask website that lets you encrypt and decrypt messages using the GOST cipher.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published