Skip to content

Sanjaykumar310/AES-encryption-with-PBKDF2HMAC-key-in-Python-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” AES & RSA Encryption Toolkit with API Integration

This repository provides a complete solution for symmetric and asymmetric encryption using AES (CBC/GCM) and RSA. It includes a Python module for local encryption/decryption, benchmarking support for large messages, and seamless API integration with a remote server for RSA operations.


πŸ“š Table of Contents


πŸš€ Features

  • πŸ” AES-256 Encryption in CBC and GCM modes.
  • πŸ›‘οΈ RSA Encryption via Public Key API.
  • πŸ“‘ Remote Encryption & Decryption using HTTP APIs.
  • πŸ“Š Benchmarking and memory profiling with memory_profiler.
  • πŸ“ Secure large-message handling (50MB+).
  • βœ… Unit tests for encryption/decryption integrity and failure scenarios.

πŸ—οΈ Architecture

                    |
                    V
          +--------------------------+
          |       RSA API Server     |
          |                          |
          | GET /get-rsa-key         |
          | POST /encrypt-rsa        |
          | POST /decrypt-rsa        |
          | POST /encrypt-aes        |
          | POST /decrypt-aes        |
          +--------------------------+

πŸ§‘β€πŸ’» Usage

from encryption import AESCipher

# AES CBC Encryption Example
cipher = AESCipher("my_secure_password", os.urandom(16), mode="CBC")
encrypted = cipher.encrypt("Hello, World!")
decrypted = cipher.decrypt(encrypted)
run_aes_operations(mode='CBC', iteration_count=2)

length = 5 * 10**7  # 50 million characters
message = ''.join(random.choices(string.ascii_letters, k=length))
run_aes_operations(mode='GCM', iteration_count=1, custom_message=message, message_print_limit=10)

response = requests.get(f"{API_URL}/v1/encryption/get-rsa-key")
public_key_pem = b64decode(response.json()['publicKey'])

# Encrypt
requests.post(f"{API_URL}/v1/encryption/encrypt-rsa", json={"message": msg, "publicKey": b64encode(pub_key).decode()})

# Decrypt
requests.post(f"{API_URL}/v1/encryption/decrypt-rsa", json={"encryptedMessage": encrypted_msg})

Original Message (CBC): CBC secret message
Encrypted (CBC): ... base64 string ...
Decrypted (CBC): CBC secret message
Elapsed Time (CBC): 0.001234 seconds
Memory Usage: 0.050Mb

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors