Question: this is instructions for the question, i already build a solution but its not working. i need help ASAP! solution is also attached Given an


Given an unencrypted public-key/private-key pair and an encrypted message, build a solution to decrypt the encrypted message and display its contents. The dataset for this milestone is attached to this dropbox You may assume that one of the standard padding libraries is used. If your library instance requires you to provide padding, set it equal to an empty string. Deliverables: 1. The contents of the encrypted message 2. Any source code (commented and readable) involved. - If you used a pre-existing tool or tools, instead of source code, a list of the tools and a description of how you used them to identify the correct file. import rsa from random import randbytes (pub, priv) = rsa.newkeys (512) print(len(pubi)) print(len(priv)) with open('private key.pem', 'rb') as private_key_file: buffered_private_key=private_key_file.read() private_key=rsa. Privatekey.load_pkcs1(buffered_private_key) with open ('public_key.pem', 'rb') as public_key_file: buffered_public_key=public_key_file.read() with open('emessage.etxt', 'rb') as message_txt_file: message_txt=message_txt_file.read() print(private_key) print(message_txt) print (len(message_txt)) print(len(buffered_private_key)) padding =b, for i in range(len(buffered_private_key)-len(message_txt)-1): print(private_key) print(message txt) print (len(message txt)) print(len(buffered_private_key)) padding =b for i in range(len(buffered_private_key)-len(message_txt)-1): padding t=b\11 print(padding) message_txt=message_txt print (len(message_txt)) unencrypted_message=rsa.decrypt(message_txt, private_key).decode() print (unencrypted_message) Given an unencrypted public-key/private-key pair and an encrypted message, build a solution to decrypt the encrypted message and display its contents. The dataset for this milestone is attached to this dropbox You may assume that one of the standard padding libraries is used. If your library instance requires you to provide padding, set it equal to an empty string. Deliverables: 1. The contents of the encrypted message 2. Any source code (commented and readable) involved. - If you used a pre-existing tool or tools, instead of source code, a list of the tools and a description of how you used them to identify the correct file. import rsa from random import randbytes (pub, priv) = rsa.newkeys (512) print(len(pubi)) print(len(priv)) with open('private key.pem', 'rb') as private_key_file: buffered_private_key=private_key_file.read() private_key=rsa. Privatekey.load_pkcs1(buffered_private_key) with open ('public_key.pem', 'rb') as public_key_file: buffered_public_key=public_key_file.read() with open('emessage.etxt', 'rb') as message_txt_file: message_txt=message_txt_file.read() print(private_key) print(message_txt) print (len(message_txt)) print(len(buffered_private_key)) padding =b, for i in range(len(buffered_private_key)-len(message_txt)-1): print(private_key) print(message txt) print (len(message txt)) print(len(buffered_private_key)) padding =b for i in range(len(buffered_private_key)-len(message_txt)-1): padding t=b\11 print(padding) message_txt=message_txt print (len(message_txt)) unencrypted_message=rsa.decrypt(message_txt, private_key).decode() print (unencrypted_message)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
