Skip to content

Encryptor.java securely encrypts files in input using AES and the Client's public key, storing encrypted files, AES keys, and their hashes in encrypted. Decryptor.java uses the User's private key to verify integrity, decrypt files to output, and deletes encrypted files after success.

Notifications You must be signed in to change notification settings

SthNoWork/SecureFileTransfer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”’ 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.

About

Encryptor.java securely encrypts files in input using AES and the Client's public key, storing encrypted files, AES keys, and their hashes in encrypted. Decryptor.java uses the User's private key to verify integrity, decrypt files to output, and deletes encrypted files after success.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages