From: Ryan on
The following code encrypts the entire section of <appSettings> in app.config.
How do I encrypt only a Key (MyKey) in that section; not the entire section?
e.g.
<add key="MyKey" value="MyKeyValue" />

Private Sub ProtectSection(ByVal sSectionName As [String])
Dim config As Configuration =
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
Dim section As ConfigurationSection = config.GetSection(sSectionName)
If section IsNot Nothing Then
If Not section.IsReadOnly() Then

section.SectionInformation.ProtectSection("RsaProtectedConfigurationProvider")
section.SectionInformation.ForceSave = True
config.Save(ConfigurationSaveMode.Modified)
End If
End If
End Sub
From: Mr. Arnold on


"Ryan" wrote:

> The following code encrypts the entire section of <appSettings> in app.config.
> How do I encrypt only a Key (MyKey) in that section; not the entire section?
> e.g.
> <add key="MyKey" value="MyKeyValue" />
>
> Private Sub ProtectSection(ByVal sSectionName As [String])
> Dim config As Configuration =
> ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
> Dim section As ConfigurationSection = config.GetSection(sSectionName)
> If section IsNot Nothing Then
> If Not section.IsReadOnly() Then
>
> section.SectionInformation.ProtectSection("RsaProtectedConfigurationProvider")
> section.SectionInformation.ForceSave = True
> config.Save(ConfigurationSaveMode.Modified)
> End If
> End If
> End Sub


About the best you could do is come up with some kind of keyboard key
strokes encryption of Shift-key, non Shift-key, Ctrl-Key, non Ctrl-key,
alpha, numeric, and special keys key combination sequence to come up with an
encrypted key for MyKeyValue.

You could get some kind of free Keylogger so you can see the results of the
keystrokes and make it a long sequence. The longer the sequence makes it
harder to crack.

You can use Google, as you might see some free code that will do it for you.