#!/usr/bin/python3 ''' Decrypts a message using RSA private key (possibly generated with rsa_key_gen.py) message may have been generated using rsa_encrypt.py Author: Tim Pierson, Dartmouth CS55, Winter 2021 Based Wenliang Du https://github.com/kevin-w-du/BookCode/tree/master/Public_Key_Cryptography Usage: python3 rsa_decrypt.py where password is the password used during key generation (from rsa_key_gen.py) python3 rsa_decrypt.py privateKey.pem cs55 ciphertext.bin ''' from Crypto.Cipher import PKCS1_OAEP from Crypto.PublicKey import RSA import sys import base64 if __name__ == '__main__': #usage check: make sure we got a filename to read if len(sys.argv) != 4: print("Usage: python3 rsa_decrypt.py