Coder Social home page Coder Social logo

shivang8 / secure-file-storage-using-hybrid-cryptography Goto Github PK

View Code? Open in Web Editor NEW
47.0 6.0 25.0 14 KB

A secure platform for storing of files using Hybrid Cryptography

Python 84.40% HTML 15.60%
python27 flask-web-service cryptography file-upload file-storage public-key-cryptography

secure-file-storage-using-hybrid-cryptography's Introduction

Secure-File-Storage-Using-Hybrid-Cryptography

Objective: To Achieve a secure plateform for storing of files on Cloud using Hybrid Cryptography.

Methodology

To achieve the above goal, the following methodology needs to be followed:

  1. Load the file on the server.
  2. Dividing the uploaded file into N parts.
  3. Encrypting all the parts of the file using any one of the selected algorithms (Algorithm is changed with every part in round robin fashion).
  4. The keys for cryptography algorithms is then secured using a different algorithm and the key for this algorithm is provided to the user as public key.

After the above 4 steps you will have a N files which are in encrypted form which are stored on the server and a key which is downloaded as public key for decrypting the file and downloading it.

To restore the file, follow the following steps:

  1. Load the key on the server.
  2. Decrypt the keys of the algorithms.
  3. Decrypt all the N parts of the file using the same algorithms which were used to encrypt them.
  4. Combine all the N parts to form the original file and provide it to the user for downloading.

How to Run

NOTE: The project is based on Python 2.7.15 plateform running it on any other plateform might create some issues.

Step 1: Install Requirements
pip install -r requirements.txt

Step 2: Run the application
python app.py

Step 3: Visit the localhost from your browser

Step 4: Enjoy :)

THE PROJECT HAS ENCOUNTERED A BUG BECAUSE OF THE CRYPTOGRAPHY LIBRARY BEING UPDATED. IF YOU ARE INTRESTED IN COLLABORATING TO IMPROVE THIS PROJECT FEEL FREE TO CONTACT ME :

Shivang Srivastava - [email protected]

secure-file-storage-using-hybrid-cryptography's People

Contributors

satyamsri8 avatar shivang8 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

secure-file-storage-using-hybrid-cryptography's Issues

Cloud service

Could u plz tell me which cloud service you have used in this project to store data?

cryptography.fernet.InvalidToken InvalidToken

Traceback (most recent call last):
File "C:\Python27\lib\site-packages\flask\app.py", line 2463, in call
return self.wsgi_app(environ, start_response)
File "C:\Python27\lib\site-packages\flask\app.py", line 2449, in wsgi_app
response = self.handle_exception(e)
File "C:\Python27\lib\site-packages\flask\app.py", line 1866, in handle_exception
reraise(exc_type, exc_value, tb)
File "C:\Python27\lib\site-packages\flask\app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "C:\Python27\lib\site-packages\flask\app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Python27\lib\site-packages\flask\app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Python27\lib\site-packages\flask\app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Python27\lib\site-packages\flask\app.py", line 1935, in dispatch_request
return self.view_functionsrule.endpoint
File "C:\Users\SID\Documents\7th Sem Books\PDL lab\Secure-File-Storage-Using-Hybrid-Cryptography\Secure-File-Storage-Using-Hybrid-Cryptography-master\app.py", line 106, in upload_key
return start_decryption()
File "C:\Users\SID\Documents\7th Sem Books\PDL lab\Secure-File-Storage-Using-Hybrid-Cryptography\Secure-File-Storage-Using-Hybrid-Cryptography-master\app.py", line 31, in start_decryption
dec.decrypter()
File "C:\Users\SID\Documents\7th Sem Books\PDL lab\Secure-File-Storage-Using-Hybrid-Cryptography\Secure-File-Storage-Using-Hybrid-Cryptography-master\decrypter.py", line 85, in decrypter
secret_information = Algo1(key_1)
File "C:\Users\SID\Documents\7th Sem Books\PDL lab\Secure-File-Storage-Using-Hybrid-Cryptography\Secure-File-Storage-Using-Hybrid-Cryptography-master\decrypter.py", line 13, in Algo1
data = f.decrypt(secret_data)
File "C:\Python27\lib\site-packages\cryptography\fernet.py", line 76, in decrypt
return self._decrypt_data(data, timestamp, ttl, int(time.time()))
File "C:\Python27\lib\site-packages\cryptography\fernet.py", line 125, in _decrypt_data
self._verify_signature(data)
File "C:\Python27\lib\site-packages\cryptography\fernet.py", line 115, in _verify_signature
raise InvalidToken
InvalidToken

Techniques

Hi Shivang,

I want to know in hybrid cryptography which encryption decryption techniques you have used....and is it able to encrypt videos and audios as well?

how to resolve this error coming after uploading file on browser

TypeError
TypeError: can only concatenate str (not "bytes") to str

Traceback (most recent call last)
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask\app.py", line 2463, in call

def __call__(self, environ, start_response):
    """The WSGI server calls the Flask application object as the
    WSGI application. This calls :meth:`wsgi_app` which can be
    wrapped to applying middleware."""
    return self.wsgi_app(environ, start_response)

def __repr__(self):
    return "<%s %r>" % (self.__class__.__name__, self.name)

File "C:\Users\HP\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask\app.py", line 2449, in wsgi_app
response = self.handle_exception(e)
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask\app.py", line 1866, in handle_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask_compat.py", line 39, in reraise
raise value
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask\app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask\app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask\app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask_compat.py", line 39, in reraise
raise value
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask\app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask\app.py", line 1935, in dispatch_request
return self.view_functionsrule.endpoint
File "C:\Users\HP\Desktop\Secure-File-Storage-Using-Hybrid-Cryptography-master\app.py", line 86, in upload_file
return start_encryption()
File "C:\Users\HP\Desktop\Secure-File-Storage-Using-Hybrid-Cryptography-master\app.py", line 27, in start_encryption
enc.encrypter()
File "C:\Users\HP\Desktop\Secure-File-Storage-Using-Hybrid-Cryptography-master\encrypter.py", line 88, in encrypter
Algo1_extented(files[index],key_1_1,key_1_2)
File "C:\Users\HP\Desktop\Secure-File-Storage-Using-Hybrid-Cryptography-master\encrypter.py", line 23, in Algo1_extented
raw = raw + line
TypeError: can only concatenate str (not "bytes") to str
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.
To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.

You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:

dump() shows all variables in the frame
dump(obj) dumps all that's known about the object

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.