简体   繁体   English

使用RsaProtectedConfigurationProvider的ProtectSection Key在哪里?

[英]ProtectSection with RsaProtectedConfigurationProvider where does the Key go?

I am using System.Configuration to encrypt and protect some passwords in a custom configuration section vis:-. 我正在使用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);
}

This appears to work fine but I need some extra information for my documentation. 这似乎工作正常,但我需要一些额外的信息,我的文档。

Where is the Key stored? 密钥存储在哪里?

How long is the Key? 钥匙有多长?

User level keys are stored at 用户级别密钥存储在

\\Documents and Settings{UserName}\\Application Data\\Microsoft\\Crypto\\RSA \\ Documents and Settings {UserName} \\ Application Data \\ Microsoft \\ Crypto \\ RSA

Machine-level keys at 机器级钥匙在

\\Documents and Settings\\All Users\\Application Data\\Microsoft\\Crypto\\RSA\\MachineKeys \\ Documents and Settings \\ All Users \\ Application Data \\ Microsoft \\ Crypto \\ RSA \\ MachineKeys

Yours is a user-level key. 您的是用户级密钥。

I had a scenario where I needed to grant a local service account access to the RsaProtectedConfigurationProvider key on a Windows 2012 server. 我有一个场景,我需要授予本地服务帐户访问Windows 2012服务器上的RsaProtectedConfigurationProvider密钥的权限。

In the end, granting access on C:\\ProgramData\\Microsoft\\Crypto\\RSA\\MachineKeys did the trick. 最后,授予对C:\\ ProgramData \\ Microsoft \\ Crypto \\ RSA \\ MachineKeys的访问权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM