11

System.Configuration を使用して、カスタム構成セクション vis:- でいくつかのパスワードを暗号化および保護しています。

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);
}

これは正常に機能しているように見えますが、ドキュメントに追加情報が必要です。

キーはどこに保管されますか?

キーの長さは?

4

2 に答える 2

10

ユーザーレベルのキーは次の場所に保存されます

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

マシンレベルの鍵

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

あなたのものはユーザーレベルのキーです。

于 2009-08-05T10:34:17.687 に答える
1

Windows 2012 サーバーの RsaProtectedConfigurationProvider キーへのローカル サービス アカウント アクセスを許可する必要があるシナリオがありました。

最終的に、C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys へのアクセスを許可するとうまくいきました。

于 2016-12-19T11:12:48.267 に答える