def search(): #User is prompted to search for something search = raw_input("*Needs work*Search for: ") #Search is sent response = urllib.urlopen("http://pgp.mit.edu:11371/pks/lookup?options=mr&op=get&search=" + search) #Result is safed to pub_key pub_key = response.read() #pub_key is stripped of they PGP lines test = AsciiData(pub_key) test.strip_magic(pub_key) #Pub key packets are listed packets = list(test.packets()) #Print Name/Email of pub_key owner for packet in packets: print packet #Promt user if add pub_key add_response = raw_input("Add this Pubkey? (yes or no) ") #If yes import key, need to update this section to parse through each key to allow selection #Mirror how pub and private keys are selected if add_response == 'yes': print "Import: ", gpg.import_keys(packet).summary() else: print "Returning"
m = rs[0] pulled_encrypt_message = m.get_body() print "Pulled Encrypted Message: " + pulled_encrypt_message decrypted_message = str(gpg.decrypt(str(pulled_encrypt_message), passphrase=password)) if decrypted_message == '': print "Posting back to SQS, incorrect key or password" q.write(m) else: print "Decrypted Message: " + decrypted_message if n.strip() == 'search': search = raw_input("Search for: ") response = urllib.urlopen("http://pgp.mit.edu:11371/pks/lookup?options=mr&op=get&search=" + search) pub_key = response.read() from pgpdump import AsciiData test = AsciiData(pub_key) test.strip_magic(pub_key) packets = list(test.packets()) print packets[1] add_response = raw_input("Add this Pubkey? (yes or no) ") if add_response == 'yes': print "Import: ", gpg.import_keys(pub_key).summary() else: print "Returning" if n.strip() == 'delete': key_id_queue = raw_input("GPG Key ID: ") sure = raw_input("Are you sure you want to delete the queue: (yes or no)") if sure == 'yes': conn.delete_queue(key_id_queue) else: print "Returning"