Skip to content

Latest commit

Β 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” Hybrid File Encryption Tool

This project implements a hybrid encryption system in Python that combines the strengths of both asymmetric (RSA) and symmetric (AES) encryption to securely encrypt and decrypt files.


πŸ›  Features

  • πŸ”‘ RSA key pair generation (2048-bit)
  • πŸ—‚ File encryption using AES-256 in CBC mode
  • πŸ” AES key encryption using RSA and OAEP padding
  • πŸ“¦ Simple CLI for encryption, decryption, and key management
  • βœ… Padding support for block alignment

πŸš€ How It Works

  1. Key Generation

    • Generates a public-private RSA key pair (private.pem and public.pem).
  2. Encryption

    • A random AES-256 key and IV are generated.
    • File content is encrypted using AES.
    • AES key is encrypted using the RSA public key.
    • Encrypted output: [IV][Encrypted AES Key][Encrypted File Data] with .enc extension.
  3. Decryption

    • Extracts IV and AES key from encrypted file.
    • Decrypts AES key using RSA private key.
    • Decrypts file using the AES key.

πŸ“‚ File Structure

hybridencrypt.py # Main Python script private.pem # RSA private key (generated) public.pem # RSA public key (generated) yourfile.txt # Your input file yourfile.txt.enc # Encrypted output yourfile_decrypted.txt # Output after decryption

yaml Copy Edit


πŸ–₯ Usage

1. Set up Environment

⚠️ Recommended: Use a Python virtual environment.

python3 -m venv venv

source venv/bin/activate

pip install pycryptodome

2. Run Script

python hybridencrypt.py

Follow the prompt:

G to generate RSA keys

E to encrypt a file

D to decrypt a .enc file

πŸ“¦ Dependencies Install using pip:

pip install pycryptodome

Make sure you're not using pycrypto β€” it's outdated. Use pycryptodome.

πŸ”’ Security Notes RSA private keys are stored unprotected. Consider securing them with passphrases or using a secure key store.

No file authentication is included β€” for production use, consider adding HMAC for integrity.

Avoid storing keys and encrypted files in the same directory in real deployments.

About

A python based tool that uses AES to encrypt files and RSA public key generated to encrypt AES key

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages