Skip to content

Latest commit

 

History

History
75 lines (46 loc) · 2.14 KB

File metadata and controls

75 lines (46 loc) · 2.14 KB

🔒 Secure File Transfer (Hybrid AES + RSA)

This Java project provides secure file encryption and decryption using a hybrid AES + RSA system.

📝 Overview

  • Main.java
    Handles both encryption and decryption automatically.

🛡️ Encryptor

  • Encrypts all files in the input folder using a generated AES key.
  • Encrypts the AES key with the Client’s public RSA key.
  • Computes a SHA-256 hash of the encrypted AES key for integrity verification.
  • Stores the following in the encrypted folder:
    • AES-encrypted files (.enc)
    • Encrypted AES keys (.key.enc)
    • SHA-256 hash of AES keys (.key.sha256)
  • Deletes the original files from input after successful encryption. ✅

🔑 Decryptor

  • Uses the User’s private RSA key to decrypt AES keys.
  • Verifies AES key integrity using the stored SHA-256 hash.
  • Decrypts the encrypted files using the decrypted AES key.
  • Outputs the decrypted files to the output folder.
  • Deletes the encrypted files after successful decryption. ✅

📂 Folder Structure

SecureFileTransfer/

├── input/ # 📥 Files to encrypt

├── encrypted/ # 🔒 Encrypted files, keys, and hashes

├── output/ # 📤 Decrypted output files

├── keys/

│ ├── User/ # 🧑‍💻 User private key

│ └── Client/ # 👤 Client public key

├── Main.java # 🏃 Handles encryption and decryption

├── Encryptor.java # ✨ Optional separate encryptor

└── Decryptor.java # ✨ Optional separate decryptor



🚀 Usage

  1. Place files you want to encrypt in the input/ folder. 📥
  2. Ensure the keys are correctly placed in keys/User and keys/Client. 🔑
  3. Run Main.java — it will automatically detect and:
    • Encrypt files if input/ contains files
    • Decrypt files if encrypted/ contains files
  4. Check the encrypted/ or output/ folders for results. 📂
  5. Original files are deleted automatically after successful operations. 🗑️

Note: The project uses AES for file encryption and RSA for secure AES key exchange, with SHA-256 hash for integrity verification.