C# RSA Decryption Issue RRS feed

  • Question

  • User1690819570 posted

    I tried encrypting connection string on my machine A .

    It was successful .

    I exported the key and the encrypted web config to some other machine B .

    It tried to decrypt the web config using that exported key as an Administrator .

    But it failed saying

    C:\Windows\system32>cd C:\Windows\Microsoft.NET\Framework64\v4.0.30319
    C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis -pi "NewEncryptKey
    " "C:\Users\abalawan\Desktop\NewStuartCN\encryptkeynew.xml"
    Importing RSA Keys from file..
    C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis -pa "NewEncryptKey
    Adding ACL for access to the RSA Key container...
    C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis -pdf "connectionSt
    rings" "C:\Users\abalawan\Desktop\NewStuartCN"
    Decrypting configuration section...
    Failed to decrypt using provider 'NewEncryptProvider'. Error message from the pr
    ovider: Not enough storage is available to process this command.
    (C:\Users\abalawan\Desktop\NewStuartCN\web.config line 35)
    Not enough storage is available to process this command.

    What am I missing here ? Any help will be much appreciated.

    Wednesday, September 9, 2015 5:08 PM

All replies

  • User585756558 posted

    @Chiranjib_Na...    welcome to forums.iis.net

    i see you've cross posted this here:  Home/ASP.NET Forums/.NET Languages/C#/C# RSA Web Config Decryption Issue

    Please check the suggestions that i posted there.

    Thursday, September 10, 2015 5:29 AM
  • User1183424175 posted


    Maybe you forget to edit your web.config on other PC:

    <configProtectedData >

    For more information, please refer to the document:


    Thursday, September 10, 2015 5:39 AM
  • User1690819570 posted


    The encrypted web.config which I copied to the other machine already had the container in place . It looks like 

    		<clear />
    		<add name="NewEncryptProvider"  type="System.Configuration.RsaProtectedConfigurationProvider,System.Configuration, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"  keyContainerName="NewEncryptKey" useMachineContainer="true"/>
      <connectionStrings configProtectionProvider="NewEncryptProvider">
        <EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element" ..............

    I also copied the key and tried to run the commands with Administrator privileges. :(
    What else can be done ?

    Thursday, September 10, 2015 6:34 AM