尝试了一下BUUCTF的rsa这道题,有关RSA算法的逆向题

首先用IDA打开pub.key,将十六进制数转为字符串,显示出公钥信息
PIC1
http://tool.chacuo.net/cryptrsakeyparse对公钥进行解析
PIC2
模数转为十进制,在http://www.factordb.com/index.php?query=86934482296048119190666062003494800588905656017203025617216654058378322103517上对模数进行分解
得到
p = 285960468890451637935629440372639283459
q = 304008741604601924494328155975272418463

脚本解密

import gmpy2
import rsa

e = 65537
n = 86934482296048119190666062003494800588905656017203025617216654058378322103517
p = 285960468890451637935629440372639283459
q = 304008741604601924494328155975272418463

phin = (q-1)*(p-1)
d = gmpy2.invert(e, phin)

key = rsa.PrivateKey(n, e, int(d), p, q)

with open("C:\\Users\\10245\\Desktop\\output\\flag.enc", "rb+") as f:
    f = f.read()
    print(rsa.decrypt(f, key))

得到flag为flag{decrypt_256}