Question: create a Python program that implements the RSA asymmetric encryption algorithm. The program will allow the user to encrypt and decrypt any file of their
create a Python program that implements the RSA asymmetric encryption algorithm. The program will allow the user to encrypt and decrypt any file of their choice, demonstrating your understanding of file handling and cryptography.Objective
Your program should:
Prompt the user to select any plaintext file.
Generate an RSA key pair public and private keys
Encrypt the selected file using the public key.
Decrypt the encrypted file using the private key.
Output both the encrypted file and the decrypted file.
Deliverables
Python File: rsaencryption.py
Report: A detailed report documenting your process, findings, and reflections.
Python Program Requirements
Your Python program should include the following features:
User Input:
Prompt the user for the path of any file they wish to encrypt. Validate to ensure the file exists and is readable.
RSA Key Generation:
Generate a pair of RSA keys public and private
Save the keys in separate files publickey.pem and privatekey.pem
File Encryption:
Read the contents of the selected file, handling both text or binary files.
Encrypt the contents using the RSA public key.
Save the encrypted data to a new file with a enc extension.
File Decryption:
Read the encrypted file.
Decrypt the data using the RSA private key.
Save the decrypted data to a new file with a dec extension.
Personalization:
Comments: Throughout your code, include comments that reflect your thought process, challenges faced, and decisions made.
For example:
# Student ID: YourName
# This function generates keys based on my understanding of cryptography principles.
Unique Functionality: Implement a unique feature that shows your understanding of coding principles, this includes error handling or logging
Variable Naming: Use variable names that your initials or personal identifiers.
For example, if your initials are AA you could name the variable like this:
aaselectedfilepath inputEnter the path of any file to encrypt:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
