#!/usr/bin/python sig=""" -----BEGIN PGP SIGNED MESSAGE----- # # checks all trusted public keys # # 2003/8/22 # """ import sys, os, pure # read secretkey if len(sys.argv) != 1: print "usage: check-keys" sys.exit(3) pure.read_cryptosystem("signingkey") pure.print_banner() pure.print_security_notice() EOL = "\n" Ring = {} collision = 0 if pure.Mode == "PURE" : KeyHome = pure.Home + "trusted-keys" else : KeyHome = pure.Home + "trusted-sha" try: KeyFiles = os.listdir(KeyHome) except: print EOL + "No trusted keys available." + EOL sys.exit(2) print "Looking for key files in ", KeyHome for File in KeyFiles : try : if File[-4:] == ".sig": FILE = open (KeyHome + "/" + File, "r") PubKey = FILE.readlines() FILE.close() print pure.Line(PubKey[5]), if pure.key_valid(PubKey) : Modulus = pure.toLong(PubKey[1]) Encryption = pure.toLong(PubKey[2]) HashModulus = pure.toLong(PubKey[3]) Generator = pure.toLong(PubKey[4]) UserID = pure.Line(PubKey[5]) Key = [Modulus, Encryption, HashModulus, Generator, UserID ] Ring [File] = Key except IOError : print "Cannot open " + File # Ring is filled with valid keys for key1 in Ring.keys() : for key2 in Ring.keys() : if (key1 != key2) and (Ring[key1][0] == Ring[key2][0]) : collision = 1 print "Collision: Common Modulus detected in files ", key1, " and " ,key2 if collision == 0 : print "NO COLLISIONS DETECTED." ################################################################ # Copyright (c) 2003 Ralf Senderek # ################################################################ sys.exit(0) sig=""" -----BEGIN PGP SIGNATURE----- Version: 2.6.3in Charset: noconv iQEVAwUBP0Ycmr6wVDeIE49tAQF7UwgAreBErlli3szRvlegwXIkpQw8Mxsjs7dq lU4iyVurew4ATqgzIGCdE6oqbHgY/UtggCL7jjvQcGcWAxSJ8lueF5KJG2fuFPWz 2lISsam5tsCAgB6TtXqi6cvfcf07L+sn++gS+wkcwlQVtnnZh6yBEy8wBL+vFZsS e070ROnPtcMF3wYkbhv8yK5rsEWNyikht5Tzr2DW6JxHWNyUiRr+8rH/ab+hw/0Q F/s8o/s4gqcpVTa9YTygm8YJMGwga4UQGIBb88IktpZwUhes6QKKymNSDDcaYTtX HpMr5/Th3aOQ8X/BTdHKMtLV4BeDouvHD64Qjd1uSP0NZTam5AGY4Q== =CsVa -----END PGP SIGNATURE----- """