Re: Problem using obfuscation



You'll need to exclude your WebProject.Global class from obfuscation in order to avoid this problem. IIRC, there's an entire tab dedicated to exclusions in the Dotfuscator UI, but you might just want to check the documentation if you can't find how to set the exclusion.



"Usman Jamil" <usman@xxxxxxxxxxx> wrote in message news:%236VEexvsGHA.1632@xxxxxxxxxxxxxxxxxxxxxxx
Hi Nicole

Thanx for your help. Its working now. I dont know what I was doing wrong but I created fresh obfuscation project, included all the assemblies in an order in which they were being used by each other and it worked fine with the test application. I really appreciate your help.

Just one problem I'm having now with the whole application obfuscated and running in actual environment. Actually my assemblies are interlinked in a strange manner perhaps thats why I'm having problems. Let me put the actual picture here.

I have a class library named Helper.dll, a remoting shared library Remoting.dll, an ASP.Net web project assembly WebProj.dll and a few .Net windows services exes. Now they are using each other in this manner.

1. Helper.dll is being used by Remtoing.dll
2. WebProj.dll is using both Remoting.dll and Helper.dll
3. .Net Windows services are using all three dlls mentioned above.

By using I mean the dlls are added in the refrences. I added all in an obfuscation project and obfuscated all the 3 dlls and my service exes. I replaced the obfuscated output assemblies in the actual folder and tried to run the WebProject from IIS and got following exception.

--------------------------------------------------------------------------------------------------
Server Error in '/' Application.
--------------------------------------------------------------------------------

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type WebProj.Global'.

Source Error:

Line 1: <%@ Application Codebehind="Global.asax.cs" Inherits="WebProj.Global" %>



Source File: /global.asax Line: 1


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
---------------------------------------------------------------------------------------------------

Do I have to obfuscate these aspx.cs files also that are using the codebehind tag to refer to the classes that were originally in WebProj.dll. If yes then how.

Thanx and Regards

Usman


"Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message news:2A454172-8F42-49EE-B3DD-1C924015F498@xxxxxxxxxxxxxxxx
Scenario 2 should work. Are any of your assemblies strongly named? Also, might you be able to provide the complete details of the TypeLoadException?


"Usman Jamil" <usman@xxxxxxxxxxx> wrote in message news:es3h$VisGHA.4748@xxxxxxxxxxxxxxxxxxxxxxx
I've tested it with following combinations. Consider there's a class library with output as Helper.dll and a console application using its classes named TestApp.exe.

1. I obfusacted the Helper.dll and tried running it with the original TestApp.exe. It failed with error TypeloadException.
2. I obfuscated the Helper.dll and TestApp.exe both and again it failed with error TypeloadException.
3. I only obfuscated the TestApp.exe and kept the Helper.dll without obfuscation. The application TestApp.exe ran without any error.

In my scenario I need both Helper.dll and TestApp.exe to be obfuscated as both contain code that I need to make complicated for decompilers. Is it possible.

Regards

Usman

"Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message news:058BCE61-D19C-4534-BFA1-2B92F5B963A8@xxxxxxxxxxxxxxxx
Are you including the executable assembly in your obfuscation run?

"Usman Jamil" <usman@xxxxxxxxxxx> wrote in message news:OrHKY%23YsGHA.3496@xxxxxxxxxxxxxxxxxxxxxxx
Hi Nicole

I'm using Dotfuscator that comes along with the Visual studio.Net. and yes
I've made a single dotfuscator project and obfuscating all the assemblies in
a single go, i.e I first compile all the code and then run dotfuscator on
all of them. I suppose this should be the correct way.Also I'm not using
reflection anywhere in my code.

For checking I created a Test .Net Class library and used it in a .Net console application. It ran fine when the exe was run with the original class library (dll). But when I placed the obfuscated dll, the console application crashed with the TypeLoadException exception with description as unable to locate that class in that dll of which I had created an object in console application.

Hope you can try simmilarly with your dotfuscator tool. Also note that I'm not using the professional or purchased version of dotfuscator instead using community edition that comes free with Visual studio.Net

Regards

Usman Jamil

"Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message
news:3B66CE26-21D2-4CE4-A8AD-CFBCCD8CB428@xxxxxxxxxxxxxxxx
"Usman Jamil" <usman@xxxxxxxxxxx> wrote in message
news:OnihjgKsGHA.5100@xxxxxxxxxxxxxxxxxxxxxxx
Hi Marcello

I'm using obfuscation for the first time, so not sure how to use it
properly. May be I'm missing something. What should be done if I have to
obfuscate multiple assemblies which are using each other's public
classes.

You would usually obfuscate the entire set of dependant assemblies
together as a group. Different obfuscators have different capabilities
with respect to tracking renamings and applying them after an initial
obfuscation run (for example, when upgrading only one assembly from an
obfuscated set). Your obfuscator's documentation and/or support forums
would probably be the best source of information on the product-specific
details.


Currently obfuscation would rename the public/private classes of my
assemblies and I guess this is the reason that crashes the
assemblies/applications that are using them.

Are you obfuscating the assemblies one-by-one, or together in a single
obfuscation run?


I'm not aware of reflection. If its a solution, can u please explain it.

It's not a solution--it's an additional problem which you may or may not
be encountering. The main issue with reflection is that it references
types and members by name at runtime, and most (all?) obfuscators do not
accomodate this. If you are using reflection (or taking advantage of
built-in framework code that uses reflection), you would usually need to
manually omit from obfuscation the types and/or members that are used via
reflection.



Regards

Usman

"Marcello Cantelmo" <marcello@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:ec8ppJ8rGHA.2124@xxxxxxxxxxxxxxxxxxxxxxx
Hi

Hi Usman,

I'm working on a project that has multiple modules. Most of the modules
(windows services, Class libraries) are coded in C#. There are multiple
class libraries which use each other's classes too having refrence
added in them. To avoid exact code decompilation, I tried using
obfuscation on all the compiled libraries(dlls). But now when I run my
project, it just crashes since the obfuscation has renamed the classes
inside those class libraries, so where ever these classes are being
refrenced, i'm getting exception.


very strange! if the classes are public do not have to be renamed! the
public field must be always visible.

What I had in mind was to compile all the code and in the end obfuscate
all the output assemblies and ship them. Does obfuscation works this
way that after obfuscating a dll we have to change the code with the
name of updated classes whereever its being refrenced or am I missing
something.


you make use of reflection?

Regards

Usman

best regards,
Marcello Cantelmo
www.cantelmosoftware.com















.



Relevant Pages

  • Re: Dotfuscator and ClickOnce
    ... I was able to apply a strong name to the application's executable by not doing it in Visual Studio ... but as part of the script I was using to run Dotfuscator. ... This occurs because obfuscation changes the binary by renaming all of the ... Authenticode signing of assemblies that you wish to obfuscate. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Problem using obfuscation
    ... with output as Helper.dll and a console application using its classes named ... I've made a single dotfuscator project and obfuscating all the assemblies ... I'm using obfuscation for the first time, so not sure how to use it ... class libraries which use each other's classes too having refrence ...
    (microsoft.public.dotnet.security)
  • Re: Dotfuscator disassociates derived class when base class is lin
    ... I tried Dotfuscator in the early days I think way back in .NET 1.1 and could ... never get it to behave and I think many other developers have found the same ... any dependency assemblies the input assembly is dependent on. ... obvioously this then defeats the purpose of obfuscation. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Dotfuscator disassociates derived class when base class is lin
    ... any dependency assemblies the input assembly is dependent on. ... become disassocarted and calls to override functions in the base class ... obvioously this then defeats the purpose of obfuscation. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Problem using obfuscation
    ... I'm using Dotfuscator that comes along with the Visual studio.Net. ... I'm using obfuscation for the first time, so not sure how to use it ... obfuscate multiple assemblies which are using each other's public ... class libraries which use each other's classes too having refrence ...
    (microsoft.public.dotnet.security)

Quantcast