1. Assembly loaded =
  2. Assembly.LoadFile(path);
  3.  
  4. byte[] evidenceKey =
  5. loaded.GetName().GetPublicKey();
  6.  
  7. if (evidenceKey != null)
  8. {
  9. byte[] internalKey =
  10. Assembly.GetExecutingAssembly().GetName().GetPublicKey();
  11.  
  12. if (evidenceKey.SequenceEqual(internalKey))
  13. {
  14. return extension;
  15. }
  16. }
  17.  
  18. [DllImport("mscoree.dll", CharSet=CharSet.Unicode)]
  19. static extern bool StrongNameSignatureVerificationEx(string wszFilePath, bool fForceVerification, ref bool pfWasVerified);