示例#1
0
        public void CreateKey(int key_id, string creators_mac_address, string sent_mac_address, string get_date, string sent_date, int key_seccurity_degree, string key_value)
        {
            JavaScriptSerializer js = new JavaScriptSerializer();

            Context.Response.Clear();
            Context.Response.ContentType = "application/json";

            Key key = new Key();

            byte[] key_value_array = kda.StringToKeyArray(key_value);
            byte[] random_array    = cc.GetRandomByteArray();
            key_value_array = cc.XORArrays(key_value_array, random_array);

            key.id = key_id;
            key.creators_mac_address = creators_mac_address;
            key.sent_mac_address     = sent_mac_address;
            key.get_date             = get_date;
            key.sent_date            = sent_date;
            key.key_seccurity_degree = key_seccurity_degree;
            key.key_value            = key_value_array;
            kda.AddKey(key);

            Context.Response.Write(js.Serialize(key));
        }