El TecnoBaúl de Kiquenet

Kiquenet boring stories

Failed to decrypt using provider ‘RsaProtectedConfigurationProvider’

Posted by kiquenet en 19 mayo 2014

The error using ConfigurationManager and RsaProtectedConfigurationProvider section:

System.Configuration.ConfigurationErrorsException: Failed to decrypt using provider ‘RsaProtectedConfigurationProvider’. Error message from the provider: The RSA key container could not be opened.

The app.config file will have been encrypted using a certificate on your local machine. This certificate will not be present on the other machine. You will therefore not be able to decrypt the app.config file.

For this to work, you need to export the encryption key on your machine, then import it on the other machine. The following article demonstrates how to do that: Walkthrough: Creating and Exporting an RSA Key Container

This is the location where all of the keys are being put:

C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys

Solution

Using this command **aspnet_regiis -pa**

Open cmd Console -execute as Administrator-

    C:\Windows\system32>aspnet_regiis -pa "NetFrameworkConfigurationKey" "myDomain\myUser"
    Microsoft (R) ASP.NET RegIIS versión 4.0.30319.33440
    Utilidad de administración que instala y desinstala ASP.NET en el equipo local.
    Copyright (C) Microsoft Corporation. Todos los derechos reservados.
    Agregando ACL para el acceso al contenedor de claves RSA…
    Con éxito

Referencias:
http://stackoverflow.com/questions/16124389/failed-to-decrypt-using-provider-rsaprotectedconfigurationprovider/16126458#16126458

http://stackoverflow.com/a/8000407/206730

http://social.msdn.microsoft.com/Forums/vstudio/en-US/88b15d6b-9baa-4f4d-8942-137185bfdf56/bug-with-encrypting-configuration-file-using-rsaprotectedconfigurationprovider?forum=netfxbcl

More references:

http://stackoverflow.com/questions/7998666/asp-net-encryption-aspnet-regiis-farm

http://stackoverflow.com/a/16126458/206730
 http://connect.microsoft.com/VisualStudio/feedback/details/511835/the-rsaprotectedconfigurationprovider-sometimes-fails-when-encrypting-an-application-configuration-file

http://ryaremchuk.blogspot.com.es/2012/11/encrypting-and-decrypting-webconfig.html

Anuncios

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s

 
A %d blogueros les gusta esto: