BUU-rsa


在线处理 .key 文件  http://tool.chacuo.net/cryptrsakeyparse

 

学习了新的解rsa的方法

以前总是直接pow去余数

然后print hex(m)[2:].decode('hex')

原来还有rsa库

首先需要密匙   key = rsa.PrivateKey(n,e,int(d),p,q)

然后直接求解    print rsa.decrypt(f,key)

太方便了。。。

import gmpy2
import rsa


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

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

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

with open("/Users/liuxingyu/Desktop/BUU/output/flag.enc", "rb+") as f:
    f = f.read()
    print rsa.decrypt(f,key)
View Code

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM