SectionInformation.ProtectSection メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > SectionInformation.ProtectSection メソッドの意味・解説 

SectionInformation.ProtectSection メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

構成セクション保護対象としてマークします。

名前空間: System.Configuration
アセンブリ: System.Configuration (system.configuration.dll 内)
構文構文

Public Sub ProtectSection ( _
    protectionProvider As String _
)
Dim instance As SectionInformation
Dim protectionProvider As String

instance.ProtectSection(protectionProvider)
public void ProtectSection (
    string protectionProvider
)
public:
void ProtectSection (
    String^ protectionProvider
)
public void ProtectSection (
    String protectionProvider
)
public function ProtectSection (
    protectionProvider : String
)

パラメータ

protectionProvider

使用する保護プロバイダの名前。

解説解説

ProtectSection メソッドは、セクション暗号化対象としてマークして、そのセクション暗号化された形式ディスク書き込まれるようにします。

既定では、次の保護プロバイダ含まれています。

  • DPAPIProtectedConfigurationProvider,

  • RSAProtectedConfigurationProvider.

保護され構成セクション詳細については、「保護され構成使用した構成情報の暗号化」を参照してください

使用例使用例

ProtectSection メソッド使用する方法コード例次に示します

Public Shared Sub ProtectSection()
 
    
    ' Get the current configuration file.
    Dim config _
    As System.Configuration.Configuration = _
    ConfigurationManager.OpenExeConfiguration( _
    ConfigurationUserLevel.None)

    
    ' Get the section.
    Dim section As UrlsSection = _
    CType(config.GetSection("MyUrls"), UrlsSection)
    
    
    ' Protect (encrypt)the section.
    section.SectionInformation.ProtectSection( _
    "RsaProtectedConfigurationProvider")
    
    ' Save the encrypted section.
    section.SectionInformation.ForceSave = True
    
    config.Save(ConfigurationSaveMode.Full)
    
    ' Display decrypted configuration 
    ' section. Note, the system
    ' uses the Rsa provider to decrypt
    ' the section transparently.
    Dim sectionXml As String
 = _
    section.SectionInformation.GetRawXml()
    
    Console.WriteLine("Decrypted section:")
    Console.WriteLine(sectionXml)

End Sub 'ProtectSection
 
static public void ProtectSection()
{

    // Get the current configuration file.
    System.Configuration.Configuration config =
            ConfigurationManager.OpenExeConfiguration(
            ConfigurationUserLevel.None);


    // Get the section.
    UrlsSection section =
        (UrlsSection)config.GetSection("MyUrls");


    // Protect (encrypt)the section.
    section.SectionInformation.ProtectSection(
        "RsaProtectedConfigurationProvider");

    // Save the encrypted section.
    section.SectionInformation.ForceSave = true;

    config.Save(ConfigurationSaveMode.Full);

    // Display decrypted configuration 
    // section. Note, the system
    // uses the Rsa provider to decrypt
    // the section transparently.
    string sectionXml =
        section.SectionInformation.GetRawXml();

    Console.WriteLine("Decrypted section:");
    Console.WriteLine(sectionXml);

}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SectionInformation クラス
SectionInformation メンバ
System.Configuration 名前空間
DpapiProtectedConfigurationProvider クラス
RsaProtectedConfigurationProvider クラス
その他の技術情報
保護され構成使用した構成情報の暗号化



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

SectionInformation.ProtectSection メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



SectionInformation.ProtectSection メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS