Web.config encryption/decryption
Posted
by Akshay
on Stack Overflow
See other posts from Stack Overflow
or by Akshay
Published on 2010-03-16T10:22:36Z
Indexed on
2010/03/16
10:26 UTC
Read the original article
Hit count: 336
In my applications we.config file I have a connection string stored. I encrypted it using
'---open the web.config file
Dim config As Configuration = _
ConfigurationManager.OpenWebConfiguration( _
Request.ApplicationPath)
'---indicate the section to protect
Dim section As ConfigurationSection = _
config.Sections("connectionStrings")
'---specify the protection provider
section.SectionInformation.ProtectSection(protectionProvider)
'---Apple the protection and update
config.Save()
Now I can decrypt it using the code
Dim config As Configuration = _
ConfigurationManager.OpenWebConfiguration( _
Request.ApplicationPath)
Dim section As ConfigurationSection = _
config.Sections("connectionStrings")
section.SectionInformation.UnProtectSection()
config.Save()
I want to know where is the key stored.
Also If somehow my web.config file is stolen, will it be possible for him/her to decrypt it using thhe code above.
© Stack Overflow or respective owner