Checking an assembly for a strong name

后端 未结 3 1316
被撕碎了的回忆
被撕碎了的回忆 2020-12-04 17:16

Is it possible to check if a dynamically loaded assembly has been signed with a specific strong name?

Is it enough / secure to compare the values returned from

3条回答
  •  不知归路
    2020-12-04 17:33

    There is no managed way to check the signature of an assembly and checking the public key leaves you vulnerable to spoofing. You will have to use P/Invoke and call the StrongNameSignatureVerificationEx function to check the signature

    [DllImport("mscoree.dll", CharSet=CharSet.Unicode)]
    static extern bool StrongNameSignatureVerificationEx(string wszFilePath, bool fForceVerification, ref bool  pfWasVerified);
    

提交回复
热议问题