コード例 #1
0
        public static string encriptacadena(string cadenaaencriptar)
        {
            CCryptorEngine cryp = new CCryptorEngine();

            byte[] bytesencriptados = cryp.Encriptar(cadenaaencriptar);
            string ax;

            ax = HttpUtility.UrlEncode(bytesencriptados);
            return(ax);
        }
コード例 #2
0
        public static bool desEncriptaCadena(String cadenaadividir, out String newcadena)
        {
            newcadena = "";
            try
            {
                //byte[] bytesadesencriptar = HttpServerUtility.UrlTokenDecode(cadenaadividir);
                byte[]         bytesadesencriptar = HttpUtility.UrlDecodeToBytes(cadenaadividir);
                CCryptorEngine cryp = new CCryptorEngine();
                newcadena = cryp.Desencriptar(bytesadesencriptar);

                //if (cadenaadividir != null)
                //{
                //    string[] elementosdehash = cadenaadividir.Split('&');

                //    foreach (string elementodehash in elementosdehash)
                //    {
                //        if (elementodehash != null && elementodehash.Length > 0)
                //        {
                //            string[] valores = elementodehash.Split('=');
                //            if (valores.Length == 2 && valores[0].ToString().Length > 0 && valores[1].ToString().Length > 0)
                //            {
                //                String par1 = valores[0].ToString();
                //                String par2 = valores[1].ToString();

                //                myQueryStrings.Add(par1, par2);
                //            }
                //            else
                //            {
                //                return false;
                //            }


                //        }

                //    }
                //}
                //else
                //{
                //    myQueryStrings.Clear();
                //    return false;
                //}
            }
            catch (Exception exception)
            {
                return(false);
            }
            return(true);
        }