<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dot Net Thoughts &#187; Connection string encryption</title>
	<atom:link href="http://www.dotnetthoughts.net/tag/connection-string-encryption/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dotnetthoughts.net</link>
	<description>thoughts about .Net, WPF, Sharepoint, Javascript and more.</description>
	<lastBuildDate>Wed, 28 Jul 2010 09:59:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Encrypting and Decrypting Configuration Sections</title>
		<link>http://www.dotnetthoughts.net/2010/02/04/encrypting-and-decrypting-configuration-sections/</link>
		<comments>http://www.dotnetthoughts.net/2010/02/04/encrypting-and-decrypting-configuration-sections/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 09:27:26 +0000</pubDate>
		<dc:creator>Anuraj P</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[.Net 3.0 / 3.5]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[Connection string encryption]]></category>

		<guid isPermaLink="false">http://www.dotnetthoughts.net/?p=746</guid>
		<description><![CDATA[Recently I got chance to work with security audit team for my web application, and one suggestion I got from them is to encrypt connection strings section in web.config. I thought it involves lot of coding changes, and I was not aware of ASP.Net utility which will help to encrypt and decrypt the connection strings [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I got chance to work with security audit team for my web application, and one suggestion I got from them is to encrypt connection strings section in web.config. I thought it involves lot of coding changes, and I was not aware of ASP.Net utility which will help to encrypt and decrypt the connection strings or appsettings sections of the web application. There is no extra coding required to use this feature. You can encrypt /decrypt the connection strings / appsettings using the ASPNET_REGIIS utility. You can find this utility in your Framework folder, normally in C:\Windows\Microsoft.NET\Framework\[Version]. Or you can invoke this from Visual Studio Command Prompt.</p>
<p><strong>Encrypt the connection string </strong></p>
<pre class="brush: bash;">
aspnet_regiis -pe ConnectionString  –app &quot;/docs&quot;
</pre>
<p>where –pe is the parameter used to encrypt the section. Connection string is the section, if you want to encrypt AppSettings, use appsettings instead of Connectionstrings. And the –app parameter is used to specify the application (it must be virtual path and need to start with “/”), if –app parameter is not specified it will encrypt the Root web.config. If the application is in File System, you need to specify –pef and Physical location as the parameter.</p>
<pre class="brush: bash;">
aspnet_regiis -pef ConnectionString  –app &quot;D:\MyWebApp&quot;
</pre>
<p><strong>Decrypt the connection string</strong></p>
<p>It is almost same as Encryption, only difference is instead of –pe use –pd. And in the case of –pef use –pdf.</p>
<pre class="brush: bash;">
aspnet_regiis -pd ConnectionString  –app &quot;/docs&quot;
</pre>
<p>and</p>
<pre class="brush: bash;">
aspnet_regiis -pdf ConnectionString  –app &quot;D:\MyWebApp&quot;
</pre>
<p>You can also specify the Provider for Encryption too. Use –prov parameter for providing custom provider (You can create your own provider, for this you need to inherit from ProtectedConfigurationProvider class). By default it will be RsaProtectedConfigurationProvider.<br />
Screenshots &#8211; Before and After encrypting the app settings.</p>
<div id="attachment_748" class="wp-caption alignnone" style="width: 482px"><a href="http://www.dotnetthoughts.net/wp-content/uploads/2010/02/before_enc.jpg"><img src="http://www.dotnetthoughts.net/wp-content/uploads/2010/02/before_enc.jpg" alt="Before Encryption" title="Before Encryption" width="472" height="55" class="size-full wp-image-748" /></a><p class="wp-caption-text">Before Encryption</p></div>
<div id="attachment_758" class="wp-caption alignnone" style="width: 481px"><a href="http://www.dotnetthoughts.net/wp-content/uploads/2010/02/after_enc1.jpg"><img src="http://www.dotnetthoughts.net/wp-content/uploads/2010/02/after_enc1.jpg" alt="After Encryption" title="After Encryption" width="471" height="460" class="size-full wp-image-758" /></a><p class="wp-caption-text">After Encryption</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.dotnetthoughts.net/2010/02/04/encrypting-and-decrypting-configuration-sections/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
