Mic*_*ann 10 c# encryption configuration rsa
我正在使用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);
}
Run Code Online (Sandbox Code Playgroud)
这似乎工作正常,但我需要一些额外的信息,我的文档.
密钥存储在哪里?
钥匙有多长?
迈克尔
h0b*_*0b0 10
用户级别密钥存储在
\ Documents and Settings {UserName}\Application Data\Microsoft\Crypto\RSA
机器级钥匙在
\ Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys
您的是用户级密钥.