public string getencrypt(string data)
        {
            string msg = data;

            byte[] encrypted;
            // Encrypt the string to an array of bytes.
            encrypted = AESCryptoSystem.Encrypt(msg, Key, IV);

            Dictionary <string, object> json = new Dictionary <string, object>();

            json.Add("encrypt", encrypted);
            return(JsonConvert.SerializeObject(json));
        }
        public string aes(string messageToEncrypt)
        {
            string msg = messageToEncrypt;

            byte[] encrypted;
            string roundtrip;

            // Encrypt the string to an array of bytes.
            encrypted = AESCryptoSystem.Encrypt(msg, Key, IV);
            // Decrypt the bytes to a string.
            roundtrip = AESCryptoSystem.Decrypt(encrypted, Key, IV);

            Dictionary <string, object> json = new Dictionary <string, object>();

            json.Add("data", msg);
            json.Add("encrypt", encrypted);
            json.Add("decrypt", roundtrip);
            return(JsonConvert.SerializeObject(json));
        }