Skip to content

A secure file transfer system using AES + RSA hybrid encryption, IPFS storage, and blockchain-based access control.

Notifications You must be signed in to change notification settings

Ashishkaus04/Encrypted-File-Transfer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” Encrypted File Vault

AES + RSA + IPFS + Ethereum Blockchain + Streamlit UI

A fully decentralized & secure file storage system combining AES encryption, RSA key wrapping, IPFS for file storage, and Ethereum smart contracts for metadata β€” wrapped in a modern Streamlit Web App.


Python Streamlit IPFS Ethereum Security License


πŸ“˜ Overview

This project implements a fully decentralized encrypted file vault, enabling secure file upload, storage, and retrieval using:

  • AES-256 encryption for file content
  • RSA-2048 OAEP for encrypting the AES key
  • IPFS for decentralized storage of encrypted files
  • Ethereum Blockchain (Ganache) for storing metadata
  • Streamlit UI for user-friendly interaction

πŸ—οΈ System Architecture

User (Streamlit UI)
        β”‚
        β–Ό
AES Encrypt File β†’ RSA Encrypt AES Key
        β”‚
        β–Ό
Upload Encrypted File β†’ IPFS
        β”‚
        β–Ό
Store metadata on Ethereum:
  β€’ filename
  β€’ SHA256 hash
  β€’ IPFS CID
  β€’ RSA-encrypted AES key
        β”‚
        β–Ό
Retrieve (CID) β†’ Recompute Hash β†’ Blockchain Lookup
        β”‚
        β–Ό
RSA Decrypt AES Key β†’ AES Decrypt File β†’ Download

✨ Features

πŸ”’ Encryption

  • AES-256 CBC file encryption
  • RSA-2048 key encryption

🧊 Decentralized Storage

  • Encrypted files stored on IPFS
  • Metadata stored on blockchain
  • Tamper-proof and censorship-resistant

πŸ–₯️ Modern Streamlit UI

  • Sidebar navigation
  • Upload β†’ Encrypt β†’ IPFS β†’ Blockchain
  • View all encrypted files
  • One-click decrypt & download
  • Clean dark-themed UI

🧩 CID-Based Retrieval

  • Retrieve files using IPFS CID
  • Hash auto-computed for blockchain lookup
  • Fully automated decryption flow

πŸ“‚ Project Structure

EncryptedVault/
β”‚
β”œβ”€β”€ crypto_utils/
β”‚   β”œβ”€β”€ streamlit_app.py
β”‚   β”œβ”€β”€ ipfs_uploader.py
β”‚   β”œβ”€β”€ aes_encryption.py
β”‚   β”œβ”€β”€ aes_hybrid_blockchain_multithread.py
β”‚   β”œβ”€β”€ public.pem
β”‚   └── private.pem
β”‚
β”œβ”€β”€ blockchain/
β”‚   └── FileVaultWithIPFS.sol
β”‚
└── test_files/

πŸ“¦ Requirements

Create a requirements.txt:

streamlit==1.32.0
web3==6.11.4
requests==2.31.0
pycryptodome==3.20.0
pathlib==1.0.1

Install using:

pip install -r requirements.txt

πŸ› οΈ Setup Guide

1️⃣ Clone the Repository

git clone <your_repo_url>
cd EncryptedVault

2️⃣ Create Virtual Environment

python -m venv encry
encry\Scripts\activate      # Windows
source encry/bin/activate   # Linux/Mac

3️⃣ Install Dependencies

pip install -r requirements.txt

4️⃣ Start Ganache

Ensure RPC:

http://127.0.0.1:7545

5️⃣ Deploy Smart Contract

Deploy FileVaultWithIPFS.sol using Remix, copy contract address into:

CONTRACT_ADDRESS = "0xYourContractAddressHere"

6️⃣ Generate RSA Keys

openssl genrsa -out private.pem 2048
openssl rsa -in private.pem -pubout > public.pem

7️⃣ Configure IPFS (Pinata)

Update ipfs_uploader.py:

PINATA_API_KEY = "your_api_key"
PINATA_SECRET_API_KEY = "your_secret_key"

πŸš€ Run the Application

streamlit run crypto_utils/streamlit_app.py

Then open:

http://localhost:8501

πŸ§ͺ Usage

β–Ά Upload & Encrypt File

  • Select file
  • AES encrypt
  • RSA wrap AES key
  • Upload encrypted file to IPFS
  • Store metadata on blockchain

β–Ά View All Stored Files

  • Load blockchain events
  • View all encrypted files & CIDs

β–Ά Decrypt & Download

  • Select file
  • App retrieves CID
  • Computes correct SHA256
  • Fetches blockchain record
  • Decrypts and downloads file

πŸ›‘ Security Model

Component Implementation
File Encryption AES-256-CBC
Key Encryption RSA-2048 OAEP
Integrity Check SHA256
Storage IPFS (Pinata)
Metadata Ethereum Blockchain
UI Streamlit

🌟 Future Enhancements

  • Multi-user RSA sharing
  • Preview thumbnails for images/videos
  • Local IPFS node integration
  • Folder batch encryption
  • User authentication / password-protected keys

πŸ“œ License

MIT License


πŸ‘¨β€πŸ’» Author

Developed using:

  • Python
  • Streamlit
  • Solidity
  • Web3.py
  • IPFS
  • AES/RSA cryptography