Failed to decrypt using provider 'RsaProtectedConfigurationProvider'. Error message from the provider: Bad Data.

Last post 07-06-2009 12:41 PM by mglil. 2 replies.

Sort Posts:

  • Failed to decrypt using provider 'RsaProtectedConfigurationProvider'. Error message from the provider: Bad Data.

    02-02-2008, 10:56 AM
    • Member
      point Member
    • edrod
    • Member since 02-02-2008, 3:22 PM
    • Posts 1

    Ok, I'm new to this encrypt/decrypt thing, actually never have used it before. But now I got a job Big Smile and the previous programmer encrypted the <connectionStrings> sector on the web.config file, both on testing and live servers. I developed a new site and it does have new connections. This project is part of a solution that is under the same web.config where the encrypted connectionStrings are (I hope I'm being clear). Not knowing anything about the encrypting thing I simply put the site on the server when I try to open a page that calls for my connection, the following shows:

    Configuration Error

    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

    Parser Error Message: Failed to decrypt using provider 'RsaProtectedConfigurationProvider'. Error message from the provider: Bad Data.


    Source Error:

    Line 3:    <appSettings/>
    Line 4: <connectionStrings configProtectionProvider="RsaProtectedConfigurationProvider">
    Line 5: <EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element"
    Line 6: xmlns="http://www.w3.org/2001/04/xmlenc#">
    Line 7: <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" />


     So, I read and read about the subject, turns out that I need to decrypt the web.config, add my connection and encrypt again, right? So I go to the server, command prompt and I tried running "aspnet_regiis - pdf "connectionStrings" "path to my site" ". A message "start to decrypt" shows but a little latter the same error message shows in the command prompt: Failed to decrypt using provider 'RsaProtectedConfigurationProvider'. Error message from the provider: Bad Data.

    I don't know what might be causing this...I read about containers and keys...but to be honest I still don't know how they apply. I can't mess up with the encrypted section because there are connections there other applications are using.

    I need ideas of what I can do to decrypt that. I also read that encryption is machine related, the previous programmer might have copied web.config from the live server to the testing, that would give me an error, right?

    If I cant decrypt at all, what I'm thinking is, is it possible to add new connections outside <connectionStrings>? Like, a custom section or something. I found out that I can use <location> to add another <connectionStrings> but, I don't know, yet, how to implement it. The second possible solution, not a very good one, is create the connection in run-time, on the code behind.

    Please, any light?
     

     

  • Re: Failed to decrypt using provider 'RsaProtectedConfigurationProvider'. Error message from the provider: Bad Data.

    02-02-2008, 12:49 PM
    Answer
    • All-Star
      17,453 point All-Star
    • albertpascual
    • Member since 05-23-2003, 2:11 PM
    • Riverside, CA
    • Posts 3,474

    If my memory does not fail me looks like you are missing on the configuration file the key to use to encrypt the data.

    Cheers
    Al
    My Blog
    MapStats.NET
    Please click on 'Mark as Answer' if this post answered your question!
  • Re: Failed to decrypt using provider 'RsaProtectedConfigurationProvider'. Error message from the provider: Bad Data.

    07-06-2009, 12:41 PM
    • Member
      57 point Member
    • mglil
    • Member since 07-05-2006, 2:47 PM
    • USA
    • Posts 12

     The RsaProtectedConfigurationProvider uses the machine account or the user account to encrypt the keys and save them in a file which called "key container", which usually saved in C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA. And the ASP.NET worker process identity (ASPNET user in XP/2000 or Network Service in case of 2003) should have access to these files to be able to decrypt it or you would get this error message.

    Please check this link for more information

    http://msdn.microsoft.com/en-us/library/dtkwfdky.aspx

     

    Mglil
    http://www.mglil.com
Page 1 of 1 (3 items)