This repo is created for the assignment 4 of our course Introduction to Software Systems.
Deployed on heroku at https://shrouded-mountain-98925.herokuapp.com/
- Run
git clone https://github.com/Ista2000/ISS-assign4.git
to clone this repository. - Run
virtualenv env
to create a virtual environment for the project. - Run
pip3 install -r requirements.txt
to install all the dependencies. - Run
flask run
to run the app in your localhost. - Visit
127.0.0.1:5000
for the website.
/api/generate
- Arguments:
sz
(Required): Size of the keye
(Optional): Set the e value, defaults to0x1001
- Returns
n
,e
,p
,q
,d % (p-1)
,d % (q-1)
,coeff
,d
- Arguments:
/api/encrypt
- Arguments(All required):
message
: The message to be encryptedn
: The public keye
: The exponent in the public key
- Returns the encrypted message
- Arguments(All required):
/api/decrypt
- Arguments(All required):
crypto
: The encrypted messagen
: The private keyd
: Thed
value in the private keye
: The exponent in the private keyp
: The first prime in the private keyq
: The second prime in the private key
- Returns the decrypted message
- Arguments(All required):
- The functions all use the
rsa
python library which can be installed usingpip3 install rsa
- All the util functions are written in
utils.py
generate(sz, e)
: returnsn
,e
,p
,q
,d % (p-1)
,d % (q-1)
,coeff
,d
encrypt(message, n, e)
: returns the encrypted messagedecrypt(crypto, n, d, e, p, q)
: returns the decrypted message
- Factory pattern while initializing the database. An empty constructor is used to create an instant of the database object in the
models.py
file but the app context is added inapp.py
- Singleton pattern while initializing the database. There cannot exist two different instants of the database object at some point of time, that is why a singleton pattern is alays used when initializing a database connection object
- Implemented continuous integration using TravisCI. The
.travis.yml
file is the config file used. - Unit test cases written in
tests.py
- A pipeline is set up in Heroku for continuous deployment. The link is given above. The
Procfile
file is the config file used.