blob: 74d67b8a0d6886d2673449cfdc04827597a5291e [file] [log] [blame]
Sybren Stüvel454261b2008-04-23 13:22:44 +02001#!/usr/bin/python
2
3import sys
4import rsa
5
Sybren A. Stüveld7fe5132011-07-24 17:55:45 +02006from rsa import key
Sybren A. Stüvel4e167692011-01-09 12:56:08 +01007
Sybren A. Stüveld7fe5132011-07-24 17:55:45 +02008pub = key.PublicKey(31698122414741849421263704398157795847591, 65537)
9
10priv = key.PrivateKey(31698122414741849421263704398157795847591, 65537,
11 7506520894712811128876594754922157377793, 4169414332984308880603,
12 7602535963858869797)
Sybren Stüvel454261b2008-04-23 13:22:44 +020013
14print "Running rsa.verify(verslag, pub)..."
15
Sybren A. Stüvel4e167692011-01-09 12:56:08 +010016crypto = open('verslag.crypt').read()
17verslag = rsa.verify(crypto, pub)
Sybren Stüvel454261b2008-04-23 13:22:44 +020018
19print "Decryption done, press enter to read"
20sys.stdin.readline()
21print verslag
22
23print "Generating public & private keypair for demonstrational purposes..."
Sybren A. Stüvel4e167692011-01-09 12:56:08 +010024(pub, priv) = rsa.newkeys(256)
Sybren Stüvel454261b2008-04-23 13:22:44 +020025
26print
27print "Public:"
28print "\te: %d" % pub['e']
29print "\tn: %d" % pub['n']
30print
31
32print "Private:"
33print "\td: %d" % priv['d']
34print "\tp: %d" % priv['p']
35print "\tq: %d" % priv['q']
36