标签:font mamicode private rsa src pen div span imp
给的文件夹中有个pub.key,里面是公钥,
-----BEGIN PUBLIC KEY-----
MDwwDQYJKoZIhvcNAQEBBQADKwAwKAIhAMAzLFxkrkcYL2wch21CM2kQVFpY9+7+
/AvKr1rzQczdAgMBAAE=
-----END PUBLIC KEY-----
在线分解
得到n,e
得到p和q,写脚本
import gmpy2
import rsa
e=65537
n=86934482296048119190666062003494800588905656017203025617216654058378322103517
p=285960468890451637935629440372639283459
q=304008741604601924494328155975272418463
phin = (p-1) * (q-1)
d=gmpy2.invert(e, phin)
key=rsa.PrivateKey(n,e,int(d),p,q)
with open("flag.enc","rb") as f:
f=f.read()
print(rsa.decrypt(f,key))
得到flag
标签:font mamicode private rsa src pen div span imp
原文地址:https://www.cnblogs.com/harmonica11/p/11504291.html