Want more features on Pastebin? Sign Up, it's FREE!
Guest

Checking an assembly for a strong name

By: a guest on Feb 28th, 2012  |  syntax: None  |  size: 0.49 KB  |  views: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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);
clone this paste RAW Paste Data