Tags: crypto rsa
Rating:
Given message.txt file which consists of many cipher texts and also (n,e) = (627585038806247,65537) are given.
Since they've given ciphertext and publickey exponent we only need to find private key exponent.
To find the value of d, we need to find p and q values
Modulus (n) can be factorized by using online factorization tool [factordb](http://http://factordb.com/).
```
from Crypto.Util.number import *
c = [145213650433152, 4562349440334, 24272724667960, 598242834066721, 89584939111364, 426756492371444, 511701778613016, 551732685650248, 296367799892003, 63113462897284, 198510931603899, 321201931522255, 401044612595398, 542697603423052, 213898535689643, 275839755798105, 185841409622217, 551732685650248, 121188708737752, 401044612595398, 512808963720303, 275839755798105, 198510931603899, 275839755798105, 401044612595398, 174484844253615, 551732685650248, 174486913717420, 575163265381617, 213898535689643, 401044612595398, 49103824223436, 551732685650248, 401044612595398, 598242834066721, 202722428784490, 306606077829794, 53801100921263, 401044612595398, 184805755675232, 405971446461049, 296367799892003, 275839755798105, 275839755798105, 401044612595398, 358054299396778, 4562349440334, 320837325468842, 401044612595398, 202722428784490, 551732685650248, 321201931522255, 228350651363859]
n = 627585038806247
e = 65537
#factorize n to get values of p & q
p = 13458281
q = 46631887
phi = (p-1)*(q-1)
d = inverse(e,phi)
m = ''
for i in c:
m += long_to_bytes(pow(i,d,n))
print m
```
**Flag: auctf{R34lLy_Pr1M3s_w1L1_n3vEr_b3_thI5_Sm411_BuT_h3y}**