title: How to check if dll is signed by Microsoft in C#
body: <p>I want to check whether a dll or exe is signed by Microsoft Corporation. How can I check this in C# without loading the dll?</p>
  
  <p>This is what I use to check the signed assembly info.</p>
  
  <pre><code>X509Certificate2 signedassembly = null;
  try
  {
      signedassembly = new X509Certificate2(X509Certificate.CreateFromSignedFile(dll));
  }
  catch(Exception e)
  {
      Logger.Info($"Potential Hack: {dll} is not verified!. Aborting.");
      return false;
  }
  </code></pre>
  
  <p>But for Microsoft dll this is always returns null.</p>
  
  <p>any idea would be appreciated.</p>