Error encrypting using RsaProtectedConfigurationProvider in EntLib 5.0 Configuration Console

Topics: Data Access Application Block
Oct 3, 2010 at 6:00 AM
Edited Oct 3, 2010 at 6:00 AM

Hi,

I'm using EntLib 5.0 in Visual Studio 2010.  I am having problem encrypting using the RsaProtectedConfigurationProvider.  When I tried to save the config file, the follow error appeared.

The application could not save the configuration information to the configuration file.  Please try to save the configuration to a different file.

Error message : An error occurred executing the configuration section handler for connectionStrings.

However, after I changed the protection provider to DataProtectionConfigurationProvider, I could save the config file successfully and verified that the contect was encrypted.

Any idea why this happened?  What are the pre-requisites for using RsaProtectedConfigurationProvider?

When should one use DataProtectionConfigurationProvider over RsaProtectedConfigurationProvider and vice versa?

Thanks.

 

Best regards,

Jude.

Oct 4, 2010 at 2:11 AM

Have you read Encrypting Configuration Data from the documentation? 

 

Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.

entlib.support@avanade.com

Oct 4, 2010 at 6:43 AM

Hi Sarah,

Thanks for your reply.  This article explains when one should use DataProtectionConfigurationProvider and RsaProtectedConfigurationProvider adequately.

Thanks.

 

Best regards,

Jude.

Oct 8, 2010 at 4:44 AM

Hi,

Just want to update that this was finally resolved on my end.  An easy one too: insufficient permission to access the keys.

When I tried to encrypt using the aspnet_regiis tool from a normal user privilege command prompt, I received the following error.

System.Configuration.ConfigurationErrorsException: An error occurred executing the configuration section handler for appSettings. ---> System.Configuration.ConfigurationErrorsException: Failed to encrypt the section 'appSettings' using provider 'RsaProtectedConfigurationProvider'. Error message from the provider: Object already exists.

I tried this again from the command prompt with admin privilege, it worked.  I then launched the Configuration Console with admin rights and managed to encrypt using RsaProtectedConfigurationProvider successfully.

Thanks.

 

Best regards,

Jude.