I am trying to validate the signature of the calling assemblies in my application.
One of the steps I am taking is verifying the calling assemblies are properly signed, using this:
[DllImport("mscoree.dll", CharSet = CharSet.Unicode)]
private static extern bool StrongNameSignatureVerificationEx(string wszFilePath, bool fForceVerification, ref bool pfWasVerified);
For the most part this has been fine, but when my application runs as a windows service, these two assemblies report as unsigned:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll
C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceProcess\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.ServiceProcess.dll
So, they have public key tokens, but it is as if they were only Delay signed?
Does anyone have any insight as to why this would be? Thank you.
Edit: I am calling it like so:
var unusedVerify = false; if (!StrongNameSignatureVerificationEx(assembly.Location, true, ref unusedVerify)) { throw new UnauthorizedAccessException("unsigned"); }