This Java project provides secure file encryption and decryption using a hybrid AES + RSA system.
- Main.java
Handles both encryption and decryption automatically.
- Encrypts all files in the
inputfolder 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
encryptedfolder:- AES-encrypted files (
.enc) - Encrypted AES keys (
.key.enc) - SHA-256 hash of AES keys (
.key.sha256)
- AES-encrypted files (
- Deletes the original files from
inputafter successful encryption. ✅
- 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
outputfolder. - Deletes the encrypted files after successful decryption. ✅
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
- Place files you want to encrypt in the
input/folder. 📥 - Ensure the keys are correctly placed in
keys/Userandkeys/Client. 🔑 - Run
Main.java— it will automatically detect and:- Encrypt files if
input/contains files - Decrypt files if
encrypted/contains files
- Encrypt files if
- Check the
encrypted/oroutput/folders for results. 📂 - 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.