1
我想保護我的app.config文件中的連接字符串。我正在使用此代碼來執行此操作:用用戶級別的DPAPI保護配置文件(WinForms)
Public Shared Sub ProtectConnString()
Dim config As System.Configuration.Configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
Dim configSection As System.Configuration.ConfigurationSection
configSection = config.ConnectionStrings
If Not (configSection Is Nothing) Then
If Not (configSection.ElementInformation.IsLocked) Then
configSection.SectionInformation.ProtectSection("DataProtectionConfigurationProvider")
configSection.SectionInformation.ForceSave = True
config.Save(ConfigurationSaveMode.Full)
End If
End If
End Sub
但是,我注意到它使用的是Machine-Level DPAPI。我希望它使用用戶級DPAPI。我怎樣才能做到這一點?