Solved

Strong Naming a third party Assembly

Posted on 2004-08-12
6
887 Views
Last Modified: 2007-12-19
I have an assembly that needs to be registered in Enterprise Services. Because of this, it is strongly named. It needs to have a reference to a third party assembly that is not strongly typed. I obviously have problems compiling as is. Is there any way to strongly name a third party assembly to which I don't have the source?

-Simon
0
Comment
Question by:swex
  • 4
  • 2
6 Comments
 
LVL 2

Accepted Solution

by:
davidastle earned 500 total points
ID: 11787387
Decompile their dll!

Well, seriously, this is probably easier than what you have to do...

As an example, we will create two DLL assemblies.  One will represent your DLL, and the other will represent the third parties DLL.  We will call yours "mine.DLL" and theirs "theirs.DLL"
Lets put everything in the same path for simplicity and call it C:\MyPath

I assume you already have a key and know how to sign your assembly from .NET  ... if not I can tell you that later

Lets call your key mykey.snk, and store it at C:\MyPath\MyKey.snk

now, go to start -> search -> for files and folders, and search for ILDASM.exe
When your search finds it, remember the folder name.  Now go to start -> run ->, type in cmd, and hit enter
Now change the directory to the directory in which ILDASM is stored by typing in cd <directory path> (c:\Program Files\Microsoft Visual Studio .NET 2004\SDK\v1.1\Bin on my computer)

Now, type in (without quotes) "ILDASM C:\MyPath\theirs.DLL /out C:\MyPath\theirs.IL"
This will create MSIL source code for their dll.  Do not close your command console yet

Now, go back to your serach, and search for ILasm.exe
Now go back to your command console, and type in cd <directory path> (C:\WINNT\Microsoft.NET\Framework\v1.1.4322\ on my computer)

Now type in "ILasm /DLL /KEY=C:\MyPath\MyKey.snk C:\Maya\theirs.IL"
This will create a new dll file with the same name as the IL file (theirs.DLL)  And sign it with the specified key.

Now, go back to your project, and set the assembly options to sign with the same key as their assembly if you add a reference to their DLL, it will now compile because it is strong named with the same key!

You should have decompiled...
0
 
LVL 2

Assisted Solution

by:davidastle
davidastle earned 500 total points
ID: 11787409
Oh, and make sure you keep a backup of their DLL... i just realized that this will overwrite their DLL if it is in the same directory of the IL file and has the same name
0
 

Author Comment

by:swex
ID: 11787927
Just as a note, the line you have as:
ILDASM C:\MyPath\theirs.DLL /out C:\MyPath\theirs.IL
should really read:
 ILDASM C:\MyPath\theirs.DLL /out=C:\MyPath\theirs.IL

I'm thinking about this a bit more, and I don't think it's going to work for my purposes, I have to interact with this DLL as it runs within IIS as an application, I'm curious as to the downstream DLLs this guy will require.

You answered my question perfectly though and I'm sure it will come in handy later.

Do you know what would happen if I did the following:

- compile two DLLs (a and b) and a made reference to b
- decompile a (into IL) and recompile adding a key to strongly type
- allow a.dll to lazily register in Enterprise services and make use of it
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 2

Expert Comment

by:davidastle
ID: 11788676
no I don't know if that would work... but it sounds like a nice idea!
0
 
LVL 2

Expert Comment

by:davidastle
ID: 11793926
Did it work?
0
 

Author Comment

by:swex
ID: 11793934
I'll let you know for sure once I try it on the webserver, I might have to strong-name a few.

-sw
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
How to host windows service on Windows Server 2008 3 44
Image(7) 1 38
Calling stored proc in EDMX 11 19
fomat Json objects 6 20
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now