none
Word 2010 addin fails to get settings from encrypted app.config file RRS feed

  • Question

  • I have developed a Word addin and created MSI installer for installing this addin. During installation of addin I have encrypted app.config file's appsettings section. After my addin gets loaded, I try to get settings from app.config file and I can also update the same. On Word 2007 evertthing is working fine but on Word 2010 I am not able to read settings from encrypted app.config file and also I can not update the same. But if app.config is not encrpted then I am able to read as well as update the app.config file.

    So I am not sure why encryption of app.config file prventing me to read or update app.config in only word 2010.

    Thanks,

    kpant 

    Thursday, May 17, 2012 8:59 AM

Answers

  • Thanks T.x for reply.

    I have resolved the issue now.

    Actually earlier I didn't add useMachineProtection attribute while using provider in my app.config file( for encrypting appSettings section) as Visual studio was displaying a warning like this attribute does not exist.

    When I investigated my logfiles for word 2010 addin, I got exception RSA key container could not be opened. When I search regarding the same I come to know that I need to use useMachineProtection attribute. So I just ignored the VisualStudio warning and set useMachineProtection=true as following. And my plug-in started reading encrpted config file on Word 2010.

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

    Best Regards,

    kpant


    kpant

    • Marked as answer by kpant Friday, May 18, 2012 7:56 AM
    • Unmarked as answer by kpant Friday, May 18, 2012 7:56 AM
    • Marked as answer by kpant Friday, May 18, 2012 7:58 AM
    Friday, May 18, 2012 7:56 AM

All replies

  • Hi kpant,

    Would you please show your snippet for further research. It's based on my experience that can't find the configuration file correctly is a frequently problem in your issue. I'm wondering whether you found configuration file indeed.

    Best Regards,

    T.x.

    Friday, May 18, 2012 5:23 AM
  • Thanks T.x for reply.

    I have resolved the issue now.

    Actually earlier I didn't add useMachineProtection attribute while using provider in my app.config file( for encrypting appSettings section) as Visual studio was displaying a warning like this attribute does not exist.

    When I investigated my logfiles for word 2010 addin, I got exception RSA key container could not be opened. When I search regarding the same I come to know that I need to use useMachineProtection attribute. So I just ignored the VisualStudio warning and set useMachineProtection=true as following. And my plug-in started reading encrpted config file on Word 2010.

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

    Best Regards,

    kpant


    kpant

    • Marked as answer by kpant Friday, May 18, 2012 7:56 AM
    • Unmarked as answer by kpant Friday, May 18, 2012 7:56 AM
    • Marked as answer by kpant Friday, May 18, 2012 7:58 AM
    Friday, May 18, 2012 7:56 AM