Managing Configuration Data Programmatically in ASP.NET 2.0
page 4 of 6
by SANJIT SIL
Feedback
Average Rating: 
Views (Total / Last 10 Days): 28103/ 66

Configuration provider

To understand what we are seeing in the configuration file, we first need to realize that the runtime turns to a configuration encryption provider for encryption and decryption work. The two providers shipping in .NET 2.0 are the DataProtectionConfigurationProvider and the RSAProtectedConfigurationProvider.

The purpose of an encryption provider is quiet simple - encrypt the contents of the specified section using a particular cryptographic engine and return the results as an XML node. Likewise, the provider must be able to decrypt the contents of a given XML node.

We can specify the provider we want to use in the string passed to the Encrypt method, as we have seen in the abovementioned code snippet. In our example we are using the DataProtectionConfigurationProvider.

The DataProtectionConfigurationProvider uses the Windows Data Protection API (DPAPI). This provides a machine-specific secret key for encryption and decryption work. Because the DataProtectionConfigurationProvider relies on a machine-specific key, we can only decrypt cipher text that was encrypted on the same machine; that means we can not use a configuration file encrypted in this way on any other computer.

If we need to move configuration files with encrypted sections from machine to machine, we need the RSAProtectedConfigurationProvider. We can copy this key between computers. The RSAProtectedConfigurationProvider, as the name would imply, uses RSA public key encryption. The RSA provider is used by default. However, if we do not want to write code, we can use the command line tool aspnet_regiis. Even though building our own custom provider is possible, the golden rule as far as encryption is concerned is, "Do not build your own encryption library, but use any reliable library that exists."


View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-25 2:36:10 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search