6

Does anyone know how to disable authenticode signature verification in a .NET executable (to avoid slow startup) without using an application config file? In other words, do this:

<configuration>
    <runtime>
        <generatePublisherEvidence enabled="false"/>
    </runtime>
</configuration>

without an app.config. Is it possible?

flipdoubt
  • 13,897
  • 15
  • 64
  • 96
  • Isn't this something for the user of your application to decide? It would also be strange if your application decides to turn off the anti virus software to make it run faster. – Lars Truijens May 29 '11 at 16:05

2 Answers2

1

If you are allowed to modify the Main() method, then what you could do is the following in your Main:

  1. Create an application config file in memory with generatePublisherEvidence
  2. Create a new application domain using the newly created application config file
  3. Run the original Main in the other application domain

This will allow you not to have an application config file, but be able to have all the customization you would want to have in the application config file.

earlNameless
  • 2,878
  • 20
  • 25
  • I don't think this would work. The framework would have to check the setting (and generate the evidence or not) before any of the code ran, including the Main method. – Miral Dec 12 '11 at 22:29
0

Well, according to MSDN the element generatePublishersEvidence can only be used in a configuration file:

Configuration File

This element can be used only in the application configuration file.

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

Dirk Vollmar
  • 172,527
  • 53
  • 255
  • 316