#NEWLINE# def do_unpadded_rsa_attack( ) : #NEWLINE# #INDENT# rsaparams = generate_rsa_key ( 2048 ) #NEWLINE# e = rsaparams [ 'e' ] #NEWLINE# N = rsaparams [ 'N' ] #NEWLINE# messageBytes = b'Oh captain my captain' #NEWLINE# messageInt = int . from_bytes ( messageBytes , byteorder = 'big' ) #NEWLINE# capturedCipher = capture_ciphertext ( messageInt , N , e ) #NEWLINE# S = 8675309 #NEWLINE# C_prime = ( ( mypow ( S , e , N ) * capturedCipher ) % N ) #NEWLINE# P_prime = decrypt_cipher ( C_prime , rsaparams ) #NEWLINE# plain = ( ( P_prime * invmod ( S , N ) ) % N ) #NEWLINE# assert ( plain == messageInt )