1. Sybren Stüvel
  2. python-rsa

Source

python-rsa / runme.py

#!/usr/bin/python

import sys
import rsa

pub = {'e': 248780186015280096941266517855109524861L, 'n': 289829846799217715870297548823528254304373554012264300246542488949110436220426067982155063515456468780177806574004719751854439098845391023946149242816599L}

print "Running rsa.verify(verslag, pub)..."

verslag = """
eJzNmruVXccORH1GIkur0V8gByYhX4byt7Q3zigHUY985Nzz6QYKVQX0/ePvf+LX74iX+4zMGvnO
nWeOk/vtNe98Nc7ZVbHWevPsPJsL+HtWrn1fjrty5qo4tSvfynVm3rXz5uGKkXvuE+Psl3PH9K9z
ZozHHZeramZOXnnezpqD/7+r9lj7vPf7118sbrMW3v+CD3n8Y2V75YtMf7BrPB5++Jy31ok567ke
LnonkuUOl7lqrv34HRHznj02964b943tUvM8Hpcr422Ws9+blfPNO/h9TvHay57WqssrWZSLq+K1
c69jVOZcWey4xnj5NmF4+27evnkp4Xrses85Yo16o4J/VhLQEWxh3XHGead4Pn+re8qrfPpMbolb
91bcGXuMrHffjn1Z3HmsJYM3rDm4gejGcW2Tt5My4k622NqIuZbv51WLpBLFu2PtvYu8sCPSTFyD
3T/zz+NP1WVt3F1smRCT+mTh6d5MOJlaLjuKyK01H+u6tQ5bXffwmwdeYEXgzyAk583sxcVbLHve
XoKxKFFTQCiAXRGtsdfgfTd9/CMipGvuflKRIt5PoMDoegbgAqAQrAEaL+kFEvFG8AJ2QPBO8J5N
ukEi73iDPPMU0MKTRqQJJojVi1u+lB+6e2rjhBn2vYc8HNBSJJ6Y8IlJzryknN12Kk5NCoqQWlW8
Cey6LCI+kwizg0tRmKdJLMnk5fOR89yzuPNMw04uQRk/YzeL9FJxa3RW2SWfRb5Jsh/pvwBsHPDw
ksfyVpBHpMiiZUoagDD1QF52jMs1PJKSI/MAGhwOdhsXcBBgHkK1chMpZ2lEixrbYR0RvAe4CTFA
oqwiQZ97AKhU7P2/l0PATgV/DZe9wuQSCTBbgCtIwsotdUEUPIxEb5LPWwZUt4CSF8E4cCIVE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P8HS3Ahdcjbr2NfUAf7ziR9hArnVdrK4dz9a8GPQVO
O+7+flB7Lm0YIu+snWJyUOL3KjwOxPFYKX1iI8M58fQomQdKVq+/P6TdeN9XS1RopOOpfbbHtjT9
9RXt6vPj73xECqc0z/ddAA8/ZeGlaZdebU/Ip5NMVNxuIjxBJMLVRy5+UajPCz1M7I5Qwna8rf3x
qwJ+QYkCcEhHLs7r1tNv3JT9pm4Zlurx1/bLDT1/EQvhfX08+82cTHBPuQyFx8m3AegXrxyJlt8g
CL8UIS/zCEFNN2BX4OHGJ/nORj172z1k9VyHjfEStyWROwN2gc9JjQcBKYZBt016Op8jP6u/nDV8
lyd/2QbOSZQC4djRYsdfl98D0DJ5bLwUtAZ8T7y/J0naQvAb7VteFJyc6ZhaMj8t3Y7QHPn3sZFf
7lnZAvlen6ykI0R8XXtKh5z2cbYzfvVILlAqp8MKj9+GM+l00kzMPXEEm/g/pM+ee7Y/d4T0bC4c
un9OjiBdB2MOOz2BcU9IhLrkAeLrlty5l9NU5zBAyIN6CxKUKNBOrJengHaaw1m7teeXjba90JS9
t+LXYydPKZ+MYUMp2/Q34vBVTqq7cWBv1uqf/wKdojc5
"""

verslag = rsa.verify(verslag, pub)

print "Decryption done, press enter to read"
sys.stdin.readline()
print verslag

print "Generating public & private keypair for demonstrational purposes..."
(pub, priv) = rsa.gen_pubpriv_keys(256)

print
print "Public:"
print "\te: %d" % pub['e']
print "\tn: %d" % pub['n']
print

print "Private:"
print "\td: %d" % priv['d']
print "\tp: %d" % priv['p']
print "\tq: %d" % priv['q']