RSA-ctf-1

备了个课,列个最基本的rsa知识。

工具

  • windows yafu分解n
  • factordb
  • python gmpy2、pycrypto、rsatool、primefac
  • openssl

基本知识

  • c = pow(m, e, n)
  • m = pow(c, d, n)
  • p q大素数
  • n = p * q
  • phi = (p-1) * (q-1)
  • gcd(e, phi) == 1
  • d = gmpy2.invert(e, phi)
查看公钥文件
openssl rsa -pubin -in pubkey.pem -text -modulus
解密
rsautl -decrypt -inkey private.pem -in flag.enc -out flag

常见攻击

  • e = 3
  • e 大
posted @ 2018-11-01 14:54  Sissel  阅读(490)  评论(0编辑  收藏  举报