private WCMSEncryptDecryptKey GetEncryptKey()
        {
            WCMSEncryptDecryptKey okey = new WCMSEncryptDecryptKey();
            string EncKey = "";
            Random random = new Random();

            int i = random.Next(25);

            EncKey = GenerateKey[i];

            okey.KeyIndex = i;
            okey.KeyValue = EncKey;


            return(okey);
        }
        public string Encrypt(string stringToEncrypt)
        {
            try
            {
                oDbzEncryptDecryptKey = GetEncryptKey();

                key = System.Text.Encoding.UTF8.GetBytes(oDbzEncryptDecryptKey.KeyValue);
                DESCryptoServiceProvider des = new DESCryptoServiceProvider();
                byte[]       inputByteArray  = Encoding.UTF8.GetBytes(stringToEncrypt);
                MemoryStream ms = new MemoryStream();
                CryptoStream cs = new CryptoStream(ms,
                                                   des.CreateEncryptor(key, IV), CryptoStreamMode.Write);
                cs.Write(inputByteArray, 0, inputByteArray.Length);
                cs.FlushFinalBlock();
                return(Convert.ToBase64String(ms.ToArray()) + oDbzEncryptDecryptKey.KeyIndex.ToString("00"));
            }
            catch (Exception e)
            {
                return(e.Message);
            }
        }