public static bool _ConvertFromInvariantString_System_ComponentModel_Int32Converter_System_ComponentModel_ITypeDescriptorContext_System_String( ) { //class object System.ComponentModel.Int32Converter _System_ComponentModel_Int32Converter = new System.ComponentModel.Int32Converter(); //Parameters System.ComponentModel.ITypeDescriptorContext context = null; System.String text = null; //ReturnType/Value System.Object returnVal_Real = null; System.Object returnVal_Intercepted = null; //Exception System.Exception exception_Real = null; System.Exception exception_Intercepted = null; InterceptionMaintenance.disableInterception( ); try { returnVal_Real = _System_ComponentModel_Int32Converter.ConvertFromInvariantString(context, text); } catch (System.Exception e) { exception_Real = e; } InterceptionMaintenance.enableInterception( ); try { returnVal_Intercepted = _System_ComponentModel_Int32Converter.ConvertFromInvariantString(context, text); } catch (System.Exception e) { exception_Intercepted = e; } return((exception_Real.Messsage == exception_Intercepted.Message) && (returnValue_Real == returnValue_Intercepted)); }
public static bool _ConvertFromInvariantString_System_ComponentModel_Int32Converter_System_ComponentModel_ITypeDescriptorContext_System_String( ) { //class object System.ComponentModel.Int32Converter _System_ComponentModel_Int32Converter = new System.ComponentModel.Int32Converter(); //Parameters System.ComponentModel.ITypeDescriptorContext context = null; System.String text = null; //ReturnType/Value System.Object returnVal_Real = null; System.Object returnVal_Intercepted = null; //Exception System.Exception exception_Real = null; System.Exception exception_Intercepted = null; InterceptionMaintenance.disableInterception( ); try { returnVal_Real = _System_ComponentModel_Int32Converter.ConvertFromInvariantString(context,text); } catch( System.Exception e ) { exception_Real = e; } InterceptionMaintenance.enableInterception( ); try { returnVal_Intercepted = _System_ComponentModel_Int32Converter.ConvertFromInvariantString(context,text); } catch( System.Exception e ) { exception_Intercepted = e; } return( ( exception_Real.Messsage == exception_Intercepted.Message ) && ( returnValue_Real == returnValue_Intercepted ) ); }
/// <summary> /// DES解密 /// </summary> public static string DesDecrypt(string encrypted) { //小于40位时,不是有效的加密串 if (encrypted.Length <= 40) { return(""); } else if (encrypted.Length % 2 != 0) { return(""); //非偶数位不是有效的加密串 } //32位MD5校验码 string _md5 = encrypted.Substring(0, 16); _md5 += encrypted.Substring(encrypted.Length - 16); //移除MD5 encrypted = encrypted.Substring(16); encrypted = encrypted.Substring(0, encrypted.Length - 16); //进行MD5验证是否被修改 //if (_md5 != System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(encrypted, "MD5")) if (_md5 != Md5(encrypted)) { return(""); } //截取,移除前8位向量长度 string iv = encrypted.Substring(0, 8); //移除向量值 encrypted = encrypted.Substring(8); //32位整型转换器 System.ComponentModel.Int32Converter _int32 = new System.ComponentModel.Int32Converter(); //字符串转换成数组 byte[] _datas = new byte[encrypted.Length / 2]; for (int i = 0; i < _datas.Length; i++) { _datas[i] = Convert.ToByte(_int32.ConvertFromInvariantString("0x" + encrypted.Substring(i * 2, 2))); } byte[] rgbKey = System.Text.Encoding.ASCII.GetBytes("SolinArt"); byte[] rgbIV = System.Text.Encoding.ASCII.GetBytes(iv); System.Security.Cryptography.DESCryptoServiceProvider _des = new System.Security.Cryptography.DESCryptoServiceProvider(); System.Security.Cryptography.ICryptoTransform _encrypt = _des.CreateDecryptor(rgbKey, rgbIV); byte[] _result = _encrypt.TransformFinalBlock(_datas, 0, _datas.Length); _encrypt.Dispose(); _des.Clear(); return(System.Text.Encoding.UTF8.GetString(_result)); }