Beispiel #1
0
        /// <summary>
        /// 对用户ID进行DES加密
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public static string EncryptUserIdByDes(string userId)
        {
            if (userId.IsNullOrEmpty())
            {
                return("");
            }

            string val = userId + "," + DateTime.Now.Ticks;

            return(CryptographyUtils.DesEncrypt(val, UserIdDesSecretKey));
        }
Beispiel #2
0
        /// <summary>
        /// 对手机号进行DES解密
        /// </summary>
        /// <param name="mobile"></param>
        /// <returns></returns>
        public static string DecryptMobileFromApp(string mobile)
        {
            if (mobile.IsNullOrEmpty())
            {
                return("");
            }

            try
            {
                string val = CryptographyUtils.DesDecrypt(mobile, AppCreditDesSecretKey);

                if (!val.IsNullOrEmpty())
                {
                    return(val);
                }
            }
            catch (Exception ex)
            {
                // ignored
            }

            return("");
        }
Beispiel #3
0
        /// <summary>
        /// 对用户ID进行DES解密
        /// </summary>
        /// <param name="encryptUserId"></param>
        /// <returns></returns>
        public static string DecryptUserIdByDes(string encryptUserId)
        {
            if (encryptUserId.IsNullOrEmpty())
            {
                return("");
            }

            try
            {
                string   val  = CryptographyUtils.DesDecrypt(encryptUserId, UserIdDesSecretKey);
                string[] vals = val.Split(',');

                if (vals.Length == 2)
                {
                    return(vals[0]);
                }
            }
            catch (Exception ex)
            {
                // ignored
            }

            return("");
        }
Beispiel #4
0
 /// <summary>
 /// 对手机号进行DES加密
 /// </summary>
 /// <param name="mobile"></param>
 /// <returns></returns>
 public static string EncryptMobileFromApp(string mobile)
 {
     return(mobile.IsNullOrEmpty() ? "" : CryptographyUtils.DesEncrypt(mobile, AppCreditDesSecretKey));
 }