Crypto-RSA-1(crypto?)

网友投稿 293 2022-10-09


Crypto-RSA-1(crypto?)

i春秋第二届春秋欢乐赛RSA256 WP 题目链接:RSA256

0x00 查看题目内容

0x01 使用openssl查看公钥

看到public.key以后用kali linux里的openssl查看查看一下openssl 中rsa的相关命令

root@kali:~/Desktop# openssl rsa -help Usage: rsa [options] Valid options are: -help Display this summary -inform format Input format, one of DER NET PEM -outform format Output format, one of DER NET PEM PVK -in val Input file -out outfile Output file -pubin Expect a public key in input file -pubout Output a public key -passout val Output file pass phrase source -passin val Input file pass phrase source -RSAPublicKey_in Input is an RSAPublicKey -RSAPublicKey_out Output is an RSAPublicKey -noout Don't print key out -text Print the key in text -modulus Print the RSA key modulus -check Verify key consistency -* Any supported cipher -pvk-strong Enable 'Strong' PVK encoding level (default) -pvk-weak Enable 'Weak' PVK encoding level -pvk-none Don't enforce PVK encoding -engine val Use engine, possibly a hardware device

0x02 把N转成十进制

因为N是十六进制数 所以得把N转换成十进制才能用在线分解网站将其分解

root@kali:~/Desktop# python Python 2.7.15 (default, Jul 28 2018, 11:29:29) [GCC 8.1.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> Modulus=0xD99E952296A6D960DFC2504ABA545B9442D60A7B9E930AFF451C78EC55D555EB >>> Modulus 98432079271513130981267919056149161631892822707167177858831841699521774310891L

0x03因式分解

0x04 生成私钥解密

import gmpy2 import rsa p = 302825536744096741518546212761194311477 q = 325045504186436346209877301320131277983 n =9843207927151313098126791905614916163189282270716717785883184169952177431089 e = 65537 d = int(gmpy2.invert(e , (p-1) * (q-1))) privatekey = rsa.PrivateKey(n , e , d , p , q) with open("encrypted.message1" , "rb") as f: print(rsa.decrypt(f.read(), privatekey).decode()) with open("encrypted.message2" , "rb") as f: print(rsa.decrypt(f.read(), privatekey).decode()) with open("encrypted.message3" , "rb") as f: print(rsa.decrypt(f.read(), privatekey).decode())


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:密码哈希值在Oracle 12c数据库中调整(密码哈希算法)
下一篇:把T-FLASH卡做成Ubuntu Linux开机登录钥匙和gufw防火墙配置(做一个flash)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~