Click here to Skip to main content
15,881,812 members
Articles / Web Development / IIS

DPAPI and Triple DES: A powerful combination to secure connection strings and other application settings

Rate me:
Please Sign up or sign in to vote.
4.77/5 (47 votes)
26 Aug 20056 min read 133.1K   1.7K   85  
This article shows how DPAPI and Triple DES can be used to encrypt connection strings and other sensitive strings for storage in the ASP.NET web.config file.
@echo off
cls

:VARIABLES
	set enterprise_bin=C:\Documents and Settings\Hannes.Foulds\My Documents\Visual Studio Projects\Foulds.Security.EnterpriseServices\bin\Debug
	set windows_bin=C:\Documents and Settings\Hannes.Foulds\My Documents\Visual Studio Projects\Foulds.Security.WindowsService\bin\Debug

:MAIN
	cls
	
	call :SETUP_ENVIRONMENT
	REM call :DEPLOY
	
	pause

	echo.
	GOTO :EOF
	
:SETUP_ENVIRONMENT
	echo ------------------------------------------------------------
	echo SETTING UP ENVIRONMENT
	echo ------------------------------------------------------------
	call "C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\vsvars32.bat"

	echo.
	GOTO :EOF
	
:DEPLOY
	echo ------------------------------------------------------------
	echo DEPLOYING FILES
	echo ------------------------------------------------------------
	call :DEPLOY_ENTERPRISE_SERVICES
	call :DEPLOY_WINDOWS_SERVICE
	
	echo.
	GOTO :EOF
	
:DEPLOY_ENTERPRISE_SERVICES
	regsvcs "%enterprise_bin%\Foulds.Security.EnterpriseServices.dll"
	
	echo.
	GOTO :EOF

:DEPLOY_WINDOWS_SERVICE
	installutil /u "%windows_bin%\Foulds.Security.WindowsService.exe"
	installutil /username=JOHANNESFOULDS\Hannes /password=password "%windows_bin%\Foulds.Security.WindowsService.exe"
	net start DataProtectionService
	
	echo.
	GOTO :EOF

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
South Africa South Africa

Comments and Discussions