Dataset.ReadXml fails after encrypting the Identity impersonation section. Giving Circular Reference Error RRS feed

  • Question

  • We are reading web.config using Dataset.Readxml(Config).

    Recently we have applied encryption to Identity property using aspnet_regiis -pef .....

    After that reading of XML is failing giving the below exception

    "DataSet doesn't allow the circular reference in the ComplexType named ''."

    We are using Provider like this

          <add keyContainerName="NetFrameworkConfigurationKey" useMachineContainer="false" description="Uses RsaCryptoServiceProvider to encrypt and decrypt" name="RSAPROVIDER" type="System.Configuration.RsaProtectedConfigurationProvider,System.Configuration, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>

    And the identity property after the encryption looks like this

    identity configProtectionProvider="RSAPROVIDER">
          <EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element"
            <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" />
            <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
              <EncryptedKey xmlns="http://www.w3.org/2001/04/xmlenc#">
                <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5" />
                <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
                  <KeyName>Rsa Key</KeyName>
              <CipherValue>asdadd </CipherValue>

    Friday, November 9, 2012 3:08 PM

All replies

  • You have two blocks of <CipherData> one inside the key and one outside.  You need the key to decipher the data so it can't be outside the key block.


    Friday, November 9, 2012 4:18 PM
  • But this config is generated by the aspnet_regiis. If I try to remove/replace/move the <CipherData> it is showing XML error that Encrypted data must contain definition for the Cipher data. Any other possible options please ??
    Monday, November 12, 2012 4:49 AM
  • Are you saying the XML is automaticaly being generated?  If so your code is organize incorrectly.  The nesting of the XML Is incorrct.  Something may be wrong with the way your defined the namespace or incorrectly inherting the wrong class (or missing a inhertance).


    Monday, November 12, 2012 8:03 AM
  • I did not know why inheriting or a class came into picture. I did not use any DLL to encrypt the configuration section. This is the part of web.config which is encrypted using aspnet_regiis command provided by .NET. I have used the command in the below link.


    Monday, November 12, 2012 10:41 AM
  • See webpage below.  Look at the -pd option.



    Monday, November 12, 2012 10:51 AM
  • I could find nothing sire.

    Suggesting to decrypt?? That one anyway works :)

    Wednesday, November 14, 2012 6:52 AM
  • Did the change work? Not sure by your response.  If it did fix the problem can you post the new xml file so others can see the how the xml has changed.


    Wednesday, November 14, 2012 10:57 AM