日期:2014-05-17  浏览次数:20476 次

DESCryptoServiceProvider加密解密问题,在线等
这是加密的方法

----------------------------------------------------------
这是我找了两个解密的不好使



求高手指点,怎么根据第一个加密方法解密出文本来!
在线等!
解密 加密

------解决方案--------------------
哥给你贴个例子吧,呵呵

        /// <summary>
        /// 类型:方法
        /// 方法名称:加密字符串
        /// 方法说明:根据传入的字符串和密匙返回加密后的字串
        /// </summary>
        /// <param name="strText">加密前的原文</param>
        /// <param name="strKey">密匙</param>
        /// <returns>加密后的字串</returns>
        public static string Encrypt(string strText, string strKey)
        {
            strKey += "etk579@#$am";
            Byte[] byKey = { };
            Byte[] IV = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF };
            try
            {
                byKey = System.Text.Encoding.UTF8.GetBytes(strKey.Substring(0, 8));
                DESCryptoServiceProvider des = new DESCryptoServiceProvider();
                Byte[] inputByteArray = System.Text.Encoding.UTF8.GetBytes(strText);
                MemoryStream ms = new MemoryStream();
                CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(byKey, IV), CryptoStreamMode.Write);
            &n