【发布时间】:2010-11-14 14:18:47
【问题描述】:
我正在使用 System.Configuration 来加密和保护自定义配置部分中的一些密码:-.
static public void SetPassAndProtectSection(string newPassword)
{
// Get the current configuration file.
System.Configuration.Configuration config =
ConfigurationManager.OpenExeConfiguration(
ConfigurationUserLevel.None);
// Get the section.
MyAppProtectedSection section =
(MyAppProtectedSection)config.GetSection(DEFAULT_SECTION_NAME);
section.DBPassword = newPassword;
// Protect (encrypt)the section.
section.SectionInformation.ProtectSection("RsaProtectedConfigurationProvider");
// Save the encrypted section.
section.SectionInformation.ForceSave = true;
config.Save(ConfigurationSaveMode.Full);
}
这似乎工作正常,但我的文档需要一些额外信息。
密钥存储在哪里?
钥匙有多长?
【问题讨论】:
标签: c# configuration encryption rsa