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

VS2012 C# WindowsForm 连接 数据库,帐号密码等如何加密?
string conStr = "server=.;database=TicketManager;Uid=sa;pwd=tcaccp;";
SqlConnection con = new SqlConnection(conStr);

平时大家都习惯是这样内置连接数据库的: Uid , pwd 等信息,
但 C# (Exe) 不是很容易给破解和查看么?

那这样不是很容易给泄露了???

大家平时是如何防范的???

谢说二句,谢谢!
数据库 c# database string

------解决方案--------------------
"server=.;database=TicketManager;Uid=sa;pwd=tcaccp;" 可以加密后放在xml 程序读取、解密
------解决方案--------------------
exe 文件 可以加壳
------解决方案--------------------
可以把server=.;database=TicketManager;Uid=sa;pwd=tcaccp;";
先加密,读的时候解密
------解决方案--------------------
xml加密,然后解密。用这种方式读取app.config就可以实现。



                ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
                fileMap.ExeConfigFilename = file_name;
                // relative path names possible

                Configuration config =
                   ConfigurationManager.OpenMappedExeConfiguration(fileMap,
                   ConfigurationUserLevel.None);

                AppSettingsSection appSettings = (AppSettingsSection)config.GetSection("appSettings");

                .....

                ret_value = StaticDES.EncryptDecrypt.DecryptDES(node_value);