<EncryptionData> child node error

Topics: General discussion, Security Application Block
Jun 23, 2008 at 11:02 PM
Hi,

I have 2 applications seetings in the app.config and the appsettings section is encrypted with RSA key. As I was testing and everything was working fine, suddenly, I got an error while running the application,

{"The section is marked as being protected, but it does not have the correct format. It should contain only the <EncryptedData> child node. (D:\\Visual Studio\\test\\test\\bin\\Debug\\test.vshost.exe.Config line 10)"}

Here is the section that was being complained and as you can tell there are 2 <EncryptionMethod .... /> tags.
Can any one tell if this is the cause of error and why? My app.config also has those 2 tags.

  <appSettings configProtectionProvider="RsaProtectedConfigurationProvider">
    <EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element" xmlns="http://www.w3.org/2001/04/xmlenc#">
      <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>
          </KeyInfo>
          <CipherData>
            <CipherValue>...</CipherValue>
          </CipherData>
        </EncryptedKey>
      </KeyInfo>
      <CipherData>
        <CipherValue>...</CipherValue>
      </CipherData>
    </EncryptedData>
Jun 24, 2008 at 3:26 PM
Hi,

Can you include the complete <appSettings/> element? How did you encrypt it?

Fernando


jawtang wrote:
Hi,

I have 2 applications seetings in the app.config and the appsettings section is encrypted with RSA key. As I was testing and everything was working fine, suddenly, I got an error while running the application,

{"The section is marked as being protected, but it does not have the correct format. It should contain only the <EncryptedData> child node. (D:\\Visual Studio\\test\\test\\bin\\Debug\\test.vshost.exe.Config line 10)"}

Here is the section that was being complained and as you can tell there are 2 <EncryptionMethod .... /> tags.
Can any one tell if this is the cause of error and why? My app.config also has those 2 tags.

  <appSettings configProtectionProvider="RsaProtectedConfigurationProvider">
    <EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element" xmlns="http://www.w3.org/2001/04/xmlenc#">
      <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>
          </KeyInfo>
          <CipherData>
            <CipherValue>...</CipherValue>
          </CipherData>
        </EncryptedKey>
      </KeyInfo>
      <CipherData>
        <CipherValue>...</CipherValue>
      </CipherData>
    </EncryptedData>



Jun 26, 2008 at 3:25 AM
Hi Fernando,
Thanks for taking this but the problem seem to be related "project properties". Every works fine until I go to the project properties to add or update my project assembly information. After that, vs2008 starts complain about app.config. I get around the problem by keeping a copy of app.config just in case. Thanks for you help.
Jun 26, 2008 at 2:38 PM
Hi,

Can you please describe the sequence of steps that causes this issue in for your project? I'd like to know if there's a broader issue behind what you get.

Fernando


jawtang wrote:
Hi Fernando,
Thanks for taking this but the problem seem to be related "project properties". Every works fine until I go to the project properties to add or update my project assembly information. After that, vs2008 starts complain about app.config. I get around the problem by keeping a copy of app.config just in case. Thanks for you help.


Jun 29, 2008 at 2:20 PM
Hi,

I tried again yesterday and was not able to recreate the situation. I will notice and post the steps when I run into this similar condition.
Thanks for your help.