Vikranth3140 / Encryption-Decryption-Tool

This Python tool provides a flexible way to encrypt and decrypt files using Stored Key Method and Password-Based Key Derivation.
MIT License
4 stars 5 forks source link
encryption-decryption encryption-decryption-tool ferret hacktoberfest

File Encryption and Decryption Tool

Introduction

This Python tool provides a flexible way to encrypt and decrypt files. It supports two methods of key management:

  1. Stored Key Method: Uses a securely generated key saved to a file (secret.key).
  2. Password-Based Key Derivation: Derives the encryption key from a user-provided password using PBKDF2 HMAC-SHA256 with a unique, random salt.

By combining both methods into a single script, users can choose the approach that best fits their needs, balancing convenience and security.


Features


Requirements


Installation

  1. Clone the repository

    git clone https://github.com/Vikranth3140/Encryption-Decryption-Tool.git
  2. Install Required Libraries

    Install the cryptography library using pip:

    pip install cryptography

Usage Instructions

The script is executed via the command line and supports the following operations:

Command-Line Options

1. Generate a Fernet Key (Stored Key Method)

Before encrypting files using the stored key method, you need to generate a key.

python script.py -g

Output:

Encryption key generated and saved to 'secret.key'.

2. Encrypt a File

Using Stored Key Method

python script.py -e -k <filename>

Using Password-Based Key Derivation

python script.py -e -p <filename>

Password Strength Requirements

Example:

python script.py -e -p confidential.txt

Output:

Enter password for encryption:
Password must be at least 8 characters long.
Please choose a stronger password.
Enter password for encryption:
Confirm password:
File 'confidential.txt' encrypted successfully as 'confidential.txt.encrypted' using password-based key derivation.

3. Decrypt a File

Using Stored Key Method

python script.py -d -k <filename>.encrypted

Using Password-Based Key Derivation

python script.py -d -p <filename>.encrypted

Example:

python script.py -d -p confidential.txt.encrypted

Output:

Enter password for decryption:
File 'confidential.txt.encrypted' decrypted successfully as 'confidential.txt.decrypted' using password-based key derivation.

Examples

Encrypting and Decrypting with Stored Key

  1. Generate a Key

    python script.py -g
  2. Encrypt a File

    python script.py -e -k report.pdf
  3. Decrypt the File

    python script.py -d -k report.pdf.encrypted

Encrypting and Decrypting with Password

  1. Encrypt a File

    python script.py -e -p notes.txt
    • Enter and confirm your password when prompted.
    • Ensure your password meets the complexity requirements.
  2. Decrypt the File

    python script.py -d -p notes.txt.encrypted
    • Enter the password used during encryption.

Graphics User Interface Options

image

The GUI provides the following features:

Secret Key Generation


Security Considerations


Limitations


Future Enhancements


Troubleshooting


License

This script is licensed under the MIT License.


Acknowledgments


Thank you for using this encryption tool. Your feedback and contributions are welcome!