pass if code != 200: print("'%s' returned error code: %s" % (s["host"],code)) elif not verify_notary_signature(sid, xml_text, s["public_key"]): print("Signature from '%s' failed, ignoring results" % s["host"]) else: # results are good s["results"] = xml_text except Exception, e: print("Exception contacting notary server:") traceback.print_exc(e) if output_type == "text": for s in server_list: print(50 * "*") print("Results for notary server '%s'" % s["host"]) if s["results"] is None: print("<No notary results>") else: print(notary_reply_as_text(s["results"])) elif output_type == "xml": for s in server_list: print(50 * "*") if s["results"] is None: print("<No notary results>") else: print(notary_reply_as_text(s["results"])) else: print("Unknown output type '%s'" % output_type)
notary_pub_key = open(notary_pub_key_file, 'r').read() try: code, xml_text = fetch_notary_xml(sys.argv[2], int(sys.argv[3]), sys.argv[1]) if code == 404: print "Notary has no results" elif code != 200: print "Notary server returned error code: %s" % code except Exception, e: print "Exception contacting notary server:" traceback.print_exc(e) exit(1) print 50 * "-" print "XML Response:" print xml_text print 50 * "-" if notary_pub_key: if not verify_notary_signature(sys.argv[1], xml_text, notary_pub_key): print "Signature verify failed. Results are not valid" exit(1) else: print "Warning: no public key specified, not verifying notary signature" print "Results:" print notary_reply_as_text(xml_text)
help="Port to contact the server on. Default: \'%(default)s\'.") args = parser.parse_args() try: code, xml_text = fetch_notary_xml(args.notary_server, args.notary_port, args.service_id) if code == 404: print("Notary has no results for '%s'." % args.service_id) elif code != 200: print("Notary server returned error code: %s" % code) except Exception, e: print("Exception contacting notary server:") traceback.print_exc(e) exit(1) print(50 * "-") print("XML Response:") print(xml_text) print(50 * "-") try: pub_key = open(args.notary_pubkey).read() if not verify_notary_signature(args.service_id, xml_text, pub_key): print("Signature verification failed. Results are not valid.") exit(1) except IOError: print("Warning: no public key specified, not verifying notary signature.") print("Results:") print(notary_reply_as_text(xml_text))
args = parser.parse_args() try: code, xml_text = fetch_notary_xml(args.notary_server, args.notary_port, args.service_id) if code == 404: print "Notary has no results for '%s'." % args.service_id elif code != 200: print "Notary server returned error code: %s" % code except Exception, e: print "Exception contacting notary server:" traceback.print_exc(e) exit(1) print 50 * "-" print "XML Response:" print xml_text print 50 * "-" try: pub_key = open(args.notary_pubkey).read() if not verify_notary_signature(args.service_id, xml_text, pub_key): print "Signature verification failed. Results are not valid." exit(1) except IOError: print "Warning: no public key specified, not verifying notary signature." print "Results:" print notary_reply_as_text(xml_text)
pass if code != 200: print "'%s' returned error code: %s" % (s["host"], code) elif not verify_notary_signature(sid, xml_text, s["public_key"]): print "Signature from '%s' failed, ignoring results" % s["host"] else: # results are good s["results"] = xml_text except Exception, e: print "Exception contacting notary server:" traceback.print_exc(e) if output_type == "text": for s in server_list: print 50 * "*" print "Results for notary server '%s'" % s["host"] if s["results"] is None: print "<No notary results>" else: print notary_reply_as_text(s["results"]) elif output_type == "xml": for s in server_list: print 50 * "*" if s["results"] is None: print "<No notary results>" else: print notary_reply_as_text(s["results"]) else: print "Unknown output type '%s'" % output_type