Tags: crypto

Rating:

Challenge: RSA 3
----------------------------------------
Category: Cryptography
----------------------------------------
135 points
----------------------------------------


Description:

Written by blockingthesky
We came across another message that follows the same cryptographic schema as those other RSA messages. Take a look and see if you can crack it.

Hint: You might want to read up on how RSA works.

File = rsa3

{N : e : c}
{0x27335d21ca51432fa000ddf9e81f630314a0ef2e35d81a839584c5a7356b94934630ebfc2ef9c55b111e8c373f2db66ca3be0c0818b1d4eda7d53c1bd0067f66a12897099b5e322d85a8da45b72b828813af23L : 0x10001 : 0x9b9c138e0d473b6e6cf44acfa3becb358b91d0ba9bfb37bf11effcebf9e0fe4a86439e8217819c273ea5c1c5acfd70147533aa550aa70f2e07cc98be1a1b0ea36c0738d1c994c50b1bd633e3873fc0cb377e7L}


python
#!/usr/bin/env python
import libnum

n = int('0x27335d21ca51432fa000ddf9e81f630314a0ef2e35d81a839584c5a7356b94934630ebfc2ef9c55b111e8c373f2db66ca3be0c0818b1d4eda7d53c1bd0067f66a12897099b5e322d85a8da45b72b828813af23',16)
e = int('0x10001',16)
c = int('0x9b9c138e0d473b6e6cf44acfa3becb358b91d0ba9bfb37bf11effcebf9e0fe4a86439e8217819c273ea5c1c5acfd70147533aa550aa70f2e07cc98be1a1b0ea36c0738d1c994c50b1bd633e3873fc0cb377e7',16)

""" p and q find on FactorDB """
p = 3423616853305296708261404925903697485956036650315221001507285374258954087994492532947084586412780869
q = 3423616853305296708261404925903697485956036650315221001507285374258954087994492532947084586412780871

n=p*q
phi=(p-1)*(q-1)
d = libnum.modular.invmod(e, phi)
print libnum.n2s(pow(c, d, n))

#easyctf{tw0_v3ry_merrry_tw1n_pr1m35!!_417c0d}


Original writeup (https://github.com/Ne0Lux-C1Ph3r/WRITE-UP/blob/master/EasyCTF/Cryptography/RSA_3.md).