Skip to content

Conversation

@Tarini-Ag
Copy link
Contributor

Fixes #6

This PR implements AES-256 encryption/decryption functionality as requested in issue #6.

What's Included:

Core Encryption Functions (✓ Required)

  • ✅ Secure 256-bit key generation using cryptographically secure random
  • ✅ Proper padding/unpadding functions using PKCS7
  • encrypt(text, key) function for text encryption
  • decrypt(ciphertext, key, iv) function for text decryption
  • ✅ Test block with comprehensive example usage

Stretch Tasks (✓ Completed)

  • ✅ File-based encryption/decryption for .txt files
    • encrypt_file() and decrypt_file() functions
    • Support for any file type
  • ✅ CLI-based interface using argparse
    • Text encryption mode
    • File encryption mode
    • File decryption mode
    • Optional key input via command line

Features:

  • Uses AES-256 in CBC mode
  • Proper initialization vector (IV) generation and handling
  • Base64 encoding for easy key/IV/ciphertext storage
  • Interactive test mode (runs when no CLI arguments provided)
  • Comprehensive error handling
  • Well-documented code with docstrings

Testing:

The script includes automatic testing when run without arguments, demonstrating:

  • Key generation
  • Text encryption/decryption
  • File encryption/decryption
  • Result verification

All required and stretch tasks have been completed successfully!

This module implements AES encryption and decryption, supporting both text and file encryption. It includes functions for key generation, data padding, and command-line interface for user interaction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement AES Encryption in Python

1 participant