This project offers encryption and decryption functions using the AES algorithm, supporting ECB and CBC modes to enhance data security during transmission.
- Encryption Function (
encrypt_aes
): Encrypts plaintext with AES, supports ECB and CBC modes, applies PKCS7 padding. - Decryption Function (
decrypt_aes
): Decrypts ciphertext back to plaintext, supports ECB and CBC modes, removes PKCS7 padding.
- Choose "AES encryption and Decryption" with ECB mode.
- Enter file path and key, encrypt, and save the encrypted file.
- Decrypt using the same key to retrieve the original message.
- Handles errors for incorrect file paths or empty files.
- Choose "AES encryption and Decryption" with CBC mode.
- Enter file path, IV, and key, encrypt, and save the encrypted file.
- Decrypt using the correct path and key to retrieve the original message.
This code ensures secure communication using AES for confidentiality and RSA for authentication, guaranteeing data integrity and privacy.
- RSA Key Pair Generation: Creates private and public keys for authentication.
- Authentication Functions (
auth_source_a
,auth_destination_b
): Authenticates messages by hashing and encrypting/decrypting the hash using RSA. - RSA Encryption/Decryption: Encrypts and decrypts messages using RSA with OAEP padding.
- Hashing: Computes and compares hash values using SHA-512.
- Confidentiality Authentication: Extends authentication with AES encryption for confidentiality.
- Authentication:
perform_authentication
returns True if successful, False otherwise. - Confidentiality and Authentication:
confidentiality_authentication
returns True if both processes are successful, False otherwise.
- Choose the
Authentication
option. - Enter the same message at source and destination, provide a valid public key, and run.
- Authentication fails if messages at source and destination differ.