title: Prevent external assembly injection via PublicKeyToken
body: <p>I'm using the following code:</p>
  
  <pre><code>AppDomain.CurrentDomain.AssemblyLoad += (sender, args) =&gt;
  {
      var token = args.LoadedAssembly.GetName().GetPublicKeyToken();
  
      if (!IsValidToken(token))
      {
          Process.GetCurrentProcess().Kill();
      }
  };
  </code></pre>
  
  <p>Where <code>IsValidToken()</code> compares the public key token of the assembly being loaded against a list of authorized public key tokens hardcoded in my application as byte arrays. </p>
  
  <p>Is this a good security measure to prevent code injection attacks? Also, is this necessary given the fact that I will later obfuscate my application using NetReactor? I'm trying to prevent any "snooping" into my application, not only coming from the Snoop tool, but from any external undesired sources as well.</p>