Example #1
0
        /// <summary>
        ///     Шифрует строку для Url
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public static string EncryptStringUrl(string text)
        {
            string res = TripleDesEncryption.EncryptString(text, TripleDesEncryption.KeySize128, PrivateKeyManager.GetUrlEncodingKey());

            foreach (var kvpchar in InvalidUrlChar)
            {
                res = res.Replace(kvpchar.Key, kvpchar.Value);
            }
            return(res);
        }
Example #2
0
        /// <summary>
        ///     Расшифровать строку для Url
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public static string DecryptStringUrl(string text)
        {
            if (text == null)
            {
                return(null);
            }

            foreach (var kvpchar in InvalidUrlChar)
            {
                text = text.Replace(kvpchar.Value, kvpchar.Key);
            }

            string res = TripleDesEncryption.DecryptString(text, TripleDesEncryption.KeySize128, PrivateKeyManager.GetUrlEncodingKey());

            return(res);
        }
Example #3
0
 /// <summary>
 ///     расшифровать строку через TripleDES
 /// </summary>
 /// <param name="encodedSource"></param>
 /// <returns></returns>
 public static string DecodeTripleDesString(string encodedSource)
 {
     return(TripleDesEncryption.DecryptString(encodedSource, TripleDesEncryption.KeySize192, PrivateKeyManager.GetMegatec3DESKey()));
 }