user2352554
user2352554

Reputation: 531

Strong name verification does not fail for modified assembly

I followed this video, and the steps I did were:

  1. I make a strong named assembly, a.dll from a C# class.
  2. I make b.exe from a C# class that has a reference for a.dll (a class like Program.cs in Console Application).
  3. I run b.exe, and it executes correctly.
  4. I modify the strong named a.dll, and verify that by sn -v a.dll command, and the response is: "Failed to verify assembly -- Strong name validation failed."
  5. Again I run b.exe and it works, but I expect a FileLoadException error because it's a modified assembly. In this video the error occurs!

My results are not the same as seen in the video. Is there a reason for this?

Upvotes: 1

Views: 581

Answers (1)

Damien_The_Unbeliever
Damien_The_Unbeliever

Reputation: 239784

I'm guessing you're using .NET 3.5 SP 1 or later, and I'm guessing the video is based on an earlier version, or has applied the below fix to disable the "Strong Name Signing Bypass".

Please visit How to: Disable the Strong Name Signing Bypass Feature

Starting with the .NET Framework version 3.5 Service Pack 1 (SP1), strong-name signatures are not validated when an assembly is loaded into a full-trust AppDomain ... Bypassing the validation of strong-name signatures provides significant performance improvements

So, they changed the rules, provided you're running in full-trust.

Upvotes: 2

Related Questions