Advertisement
Guest User

Checking an assembly for a strong name

a guest
Feb 28th, 2012
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  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);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement