Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How I do a sign an assembly that has already been built into a dll specifically flute.dll

People also ask

How do I sign a DLL file?

Click Start > All Programs > Accessories and right-click on "Command Prompt" and select "Run as Administrator" OR in the Search box, type CMD and when cmd.exe appears in your results, right-click on cmd.exe and select "Run as administrator" At the command prompt, enter: REGSVR32 "PATH TO THE DLL FILE"

How do I sign a DLL in Visual Studio?

You sign an application or component by using the Signing tab of the project properties window (right-click the project node in Solution Explorer and select Properties). Select the Signing tab, then select the Sign the assembly check box. Specify a key file.

Is a DLL file an assembly?

An assembly is a collection of one or more files and one of them DLL or EXE. DLL contains library code to be used by any program running on Windows. A DLL may contain either structured or object oriented libraries. A DLL file can have a nearly infinite possible entry points.


After a little searching, I found this post that explains one way of doing it.

Exerpt:

From a VS.NET command prompt, enter the following:

  1. Generate a KeyFile: sn -k keyPair.snk
  2. Obtain the MSIL for the provided assembly: ildasm providedAssembly.dll /out:providedAssembly.il
  3. Rename/move the original assembly: ren providedAssembly.dll providedAssembly.dll.orig
  4. Create a new assembly from the MSIL output and your assembly KeyFile: ilasm providedAssembly.il /dll /key=keyPair.snk

Step 1: Dis-assemble the assembly

ildasm myTest.dll /out:myTest.il 

Step 2: Re-Assemble using your strong-name key

ilasm myTest.il /res:myTest.res /dll /key:myTest.snk /out:myTestSN.dll 

For verification you can use following command:

sn -vf myTestSN.dll

Hope this helps!


This link also shows how to do it, including when one of the 3rd party assemblies you're signing has a reference to another unsigned assembly that you're signing:

http://buffered.io/posts/net-fu-signing-an-unsigned-assembly-without-delay-signing

Edit: sorry, link is busted.


The Strong Name tool can re-sign an existing assembly, using the -R option. However, from what I understand, the assembly has to be previously signed or delay-signed... not sure you can use it with an unsigned assembly, but you can give it a try