RsaProtectedConfigurationProvider Class
Collapse the table of content
Expand the table of content

RsaProtectedConfigurationProvider Class

Note: This class is new in the .NET Framework version 2.0.

Provides a ProtectedConfigurationProvider that uses RSA encryption to encrypt and decrypt configuration data.

Namespace: System.Configuration
Assembly: System.Configuration (in system.configuration.dll)

public ref class RsaProtectedConfigurationProvider sealed : public ProtectedConfigurationProvider
public final class RsaProtectedConfigurationProvider extends ProtectedConfigurationProvider
public final class RsaProtectedConfigurationProvider extends ProtectedConfigurationProvider

The RSAProtectedConfigurationProvider class gives you a way to encrypt sensitive information stored in a configuration file, which helps protect it from unauthorized access. You use the built-in RSAProtectedConfigurationProvider by declaring the provider and making appropriate settings in the configuration file instead of creating an instance of this class, as shown in the example later in this topic.

The RSAProtectedConfigurationProvider uses the cryptography functions provided by RSA class to encrypt and decrypt configuration sections.


Before ASP.NET can decrypt encrypted information in your configuration file, the identity of your ASP.NET application must have read access to the encryption key used to encrypt and decrypt the configuration data. For more information, see Walkthrough: Encrypting Configuration Information Using Protected Configuration.

The following code example shows how to use the standard RSAProtectedConfigurationProvider to protect or unprotect a configuration section.

No code example is currently available or this language may not be supported.

The following example shows an excerpt from a configuration file after encryption.

<?xml version="1.0" encoding="utf-8"?>
  <connectionStrings configProtectionProvider="RsaProtectedConfigurationProvider">
    <EncryptedData Type=""
      <EncryptionMethod Algorithm="" />
      <KeyInfo xmlns="">
        <EncryptedKey xmlns="">
          <EncryptionMethod Algorithm="" />
          <KeyInfo xmlns="">
            <KeyName>Rsa Key</KeyName>

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

© 2016 Microsoft