
Checking an assembly for a strong name
By: a guest on
Feb 28th, 2012 | syntax:
None | size: 0.49 KB | hits: 15 | expires: Never
Assembly loaded =
Assembly.LoadFile(path);
byte[] evidenceKey =
loaded.GetName().GetPublicKey();
if (evidenceKey != null)
{
byte[] internalKey =
Assembly.GetExecutingAssembly().GetName().GetPublicKey();
if (evidenceKey.SequenceEqual(internalKey))
{
return extension;
}
}
[DllImport("mscoree.dll", CharSet=CharSet.Unicode)]
static extern bool StrongNameSignatureVerificationEx(string wszFilePath, bool fForceVerification, ref bool pfWasVerified);