Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 88325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:32:32+00:00 2026-05-10T22:32:32+00:00

I have been reading the proper article in MSDN, Strong-Named Assemblies and a related

  • 0

I have been reading the proper article in MSDN, Strong-Named Assemblies and a related Stack Overflow question, Checking an assembly for a strong name.

  1. To which extent can a strong-named assembly be verified to avoid tampering?
  2. Is it possible to use strong-naming to verify an assembly author?

The first question arises after reading the CSharp411 article .NET Assembly FAQ – Part 3 – Strong Names and Signing, which mentions this, among other problems of using strong names:

‘Cannot Stop Full Replacement. Strong names cannot prevent a hacker from removing the strong name signature, maliciously modifying your assembly, re-signing it with his own key, and then passing off his assembly as yours.‘

The second question intends to find the differences between strong naming and other signing schemes like, say, Authenticode. The same MSDN article mentioned early states:

‘Note, however, that strong names in and of themselves do not imply a level of trust like that provided, for example, by a digital signature and supporting certificate.‘

Am I trying to use strong-naming for much more than it was created for? Was strong-naming created just to avoid name clashes or a new kind of ‘GAC DLL Hell’?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T22:32:33+00:00Added an answer on May 10, 2026 at 10:32 pm

    When you sign an assembly with a strong name based on a private key that you create, this has the following benefits:

    • A strong name guarantees the uniqueness of an assembly’s identity by adding a public key token and a digital signature to the assembly.
    • A strong name can be matched to a public key to prove that the assembly comes from the publisher with that public key, and only that publisher.
    • A strong name provides a strong integrity check. Passing the .NET Framework security checks guarantees that the contents of the assembly haven’t been changed since it was last built.

    Is it possible to use strong-naming to verify an assembly author?

    Yes, as discussed above strong-naming can verify the assembly’s latest author. But it doesn’t verify the original author. If an attacker replaces your assembly’s strong name, then all that can be verified is that you weren’t the latest author of the assembly. If he removes the strong name, then no author verification can be done at all.

    To which extent can a strong-named assembly be verified to avoid tampering?

    The following C# code verifies that an attacker hasn’t tampered with the public key token that was written to your assembly when you applied the strong name. It doesn’t avoid tampering, but it can detect some types of tampering. The method below accepts a byte array containing your public key token, and compares it with the actual token of the assembly. Note that for this technique to be effective, your obfuscator of choice should encrypt the string containing your public key token, and only decrypt it on the fly as it’s used. And also be aware that you need to have FullTrust permission for this code to work because it uses reflection underneath the hood.

    // Check that public key token matches what's expected. private static bool IsPublicTokenOkay_Check(byte [] tokenExpected) {     // Retrieve token from current assembly     byte [] tokenCurrent = Assembly.GetExecutingAssembly().GetName().GetPublicKeyToken();      // Check that lengths match     if (tokenExpected.Length == tokenCurrent.Length)     {         // Check that token contents match         for (int i = 0; i < tokenCurrent.Length; i++)             if (tokenExpected[i] != tokenCurrent[i])                  return false;     }     else     {         return false;     }     return true; } 

    As long as you’re running under a version of the .NET Framework before .NET 3.5 SP1, you can also force verification of the strong name signature in case the strong name was removed by an attacker or the strong name check was disabled in the registry. The following code demonstrates a call into a static method of another class called NativeMethods. This is where the verification will be enforced.

    // Check that this assembly has a strong name. private bool IsStrongNameValid_Check() {     byte wasVerified = Convert.ToByte(false);       byte forceVerification = Convert.ToByte(true);     string assemblyName = AppDomain.CurrentDomain.BaseDirectory +                            AppDomain.CurrentDomain.FriendlyName;      return NativeMethods.CheckSignature(assemblyName,                                          forceVerification,                                          ref wasVerified); } 

    The actual signature verification is done using P/Invoke as shown below. The usage of the StrongNameSignatureVerificationEx API is quite convoluted – for a decent explanation, see this blog entry.

    // P/Invoke to check various security settings // Using byte for arguments rather than bool,  // because bool won't work on 64-bit Windows! [DllImport('mscoree.dll', CharSet=CharSet.Unicode)] private static extern bool StrongNameSignatureVerificationEx(string wszFilePath,                                                               byte fForceVerification,                                                               ref byte pfWasVerified);  // Private constructor because this type has no non-static members private NativeMethods() { }  public static bool CheckSignature(string assemblyName,                                    byte forceVerification,                                    ref byte wasVerified) {     return StrongNameSignatureVerificationEx(assemblyName,                                               forceVerification,                                               ref wasVerified ); } 

    Note that this won’t work by default for applications using .NET 3.5 SP1 or higher, which has the strong name bypass feature. It’s possible to disable this feature for your application by adding a setting to its config file. But of course any attacker with read/write access to that config file can reverse your decision.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been reading the MSDN documentation on subclassing and I have been successful
I have been reading through the C++ FAQ and was curious about the friend
I have been reading about the differences between Table Variables and Temp Tables and
I have been reading through the CodePlex supported open source licenses, i couldn't quite
I have been reading up on this, and it seems that if you use
On Stackers' recommendation, I have been reading Crockford's excellent Javascript: The Good Parts .
OK, I have just been reading and trying for the last hour to import
I have been hearing and reading about Agile for years. I own a book
I have been doing a little reading on Flow Based Programming over the last
I have been reading up on multiple PHP frameworks, especially the Zend Framework but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.