隐藏重要数据 [英] Hiding Important Data

查看:106
本文介绍了隐藏重要数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只想问什么是隐藏在.net桌面应用程序的敏感数据(FTP帐号,数据库的ConnectionString等),最好的办法..任何建议,请..:)

just want to ask what would be the best way to hide sensitive data (ftp accounts, database connectionstring, etc) in .Net desktop applications.. any suggestions please.. :)

我知道把数据在应用程序和记住,如果应用程序将被模糊化或反编译什么隐藏的数据将被暴露了。

i was aware of putting data in the application and got in mind that what if the application will be deobfuscated or decompiled the hidden data will be expose.

我尝试使用应用程序设置

i tried using Application Settings

Properties.Settings.Default.MyConnectionString = theConString;



,但仍反编译时可以将数据seend

but still the data can be seend when decompiled.

任何建议,请。

推荐答案

您可以加密app.config文件的全部或部分。这是保护数据库连接字符串中特别常见。

You can encrypt all or part of the app.config file. This is particularly common for protecting database connection strings.

下面是一个的详细的文章关于如何对这一。概括地说,这里是代码从那里在app.config中加密连接字符串部分:

Here is a detailed article about how to to this. In a nutshell, here is the code from there for encrypting the connection string section in app.config:

static void ToggleConfigEncryption(string exeConfigName)
{
    // Takes the executable file name without the
    // .config extension.
    try
    {
        // Open the configuration file and retrieve 
        // the connectionStrings section.
        Configuration config = ConfigurationManager.
            OpenExeConfiguration(exeConfigName);

        ConnectionStringsSection section =
            config.GetSection("connectionStrings")
            as ConnectionStringsSection;

        if (section.SectionInformation.IsProtected)
        {
            // Remove encryption.
            section.SectionInformation.UnprotectSection();
        }
        else
        {
            // Encrypt the section.
            section.SectionInformation.ProtectSection(
                "DataProtectionConfigurationProvider");
        }
        // Save the current configuration.
        config.Save();

        Console.WriteLine("Protected={0}",
            section.SectionInformation.IsProtected);
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex.Message);
    }
}

这篇关于隐藏重要数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆