Example #1
0
        public Message invoke(Message in_msg)
        {
            CST_Ops.recordme(this, in_msg, conclusion);

            conclusion.value = in_msg.value;
            conclusion.largestParty = in_msg.largestParty;
            conclusion.SignedBy = in_msg.SignedBy;

            if (conclusion.value < data)
            {
                conclusion.largestParty = "Charles";
                conclusion.value = data;
            }
            conclusion.SignedBy = "Charles";

            if (conclude(conclusion))
            {
                conclusion.certified = true;
                Console.WriteLine("The largest party is " + conclusion.largestParty + ".");
            }
            else
            {
                conclusion.certified = false;
                Console.WriteLine("Not verified.");
            }

            return conclusion;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Message m = new Message();
            if (Message.parse(m, Request))
            {
                Message m2 = server_b.invoke(m);

                Message.respond(m2, Response);
            }
        }
Example #3
0
        public Message invoke(Message in_msg)
        {
            Message out_msg = new Message();

            CST_Ops.recordme(this, in_msg, out_msg);

            out_msg.value = data;
            out_msg.largestParty = "Alice";
            out_msg.SignedBy = "Alice";

            return out_msg;
        }
Example #4
0
        public Message invoke(Message in_msg)
        {
            Message out_msg = new Message();
            CST_Ops.recordme(this, in_msg, out_msg);
            out_msg.value = in_msg.value;
            out_msg.largestParty = in_msg.largestParty;

            if (out_msg.value < data)
            {
                out_msg.value = data;
                out_msg.largestParty = "Bob";
            }
            out_msg.SignedBy = "Bob";
            return out_msg;
        }
Example #5
0
        public static bool parse(Message msg, HttpRequest request)
        {
            msg.SymT = request.QueryString["SymT"];
            msg.SignedBy = request.QueryString["SignedBy"];
            if (request.QueryString["value"] != null)
                msg.value = Int32.Parse(request.QueryString["Value"]);
            msg.largestParty = request.QueryString["LargestParty"];

            if ((msg.SignedBy == null || msg.SignedBy.Length == 0) && !SignatureValid(request))
            {
                generateErrorResponse();
                return false;
            }
            return true;
        }
Example #6
0
        public static void respond(Message msg, HttpResponse response)
        {
            Dictionary<string, string> dict = new Dictionary<string, string>();

            dict.Add("SymT", msg.SymT);
            dict.Add("SignedBy", msg.SignedBy);
            dict.Add("LargestParty", msg.largestParty);
            dict.Add("Value", msg.value.ToString());
            dict.Add("Certified", msg.certified.ToString());

            XmlDocument doc = HTTPComm.GenerateXML(dict);

            response.StatusCode = 200;
            response.ContentType = "text/xml"; //must be 'text/xml'
            response.ContentEncoding = System.Text.Encoding.UTF8; //we'd like UTF-8
            doc.Save(response.Output);
        }
Example #7
0
 public bool conclude(Message msg)
 {
     bool result = CST_Ops.CertifyLocally(msg);
     return result;
 }