Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. When Public isnt really Public

When Public isnt really Public

Scheduled Pinned Locked Moved C#
questiondesignalgorithmsworkspace
17 Posts 8 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M MrEyes

    Its not so much about obsfucating the code The situation I am in is that I have a helper DLL that does alot of work with XML for an application I produced. The company I work for has found out that other companies are using the public interface of this DLL to perform processing on their own data. Obviously we want to stop this, but would prefer to keep the exe and helper dll seperate as it is also used by other applications. The only solution I can think of, is as you suggested, some type of session/ticket validation but before embarking on that project I was wondering if there was another way post.mode = postmodes.signature; SELECT everything FROM everywhere WHERE something = something_else; > 1 Row Returned > 42

    D Offline
    D Offline
    Dario Solera
    wrote on last edited by
    #5

    The way I'm going to explain is a little crazy... You can mask the DLL with some other filename (such as Filename.dat) and crypt it with, for example, a 3DES algorithm (provided in .NET Framework!). After this a some kind of bootstrapper is needed to decrpyt, rename, install the DLL in the GAC and start the main application. When the application is closed, the boostrapper removes the DLL from the GAC. to install the DLL in the GAC you can use the utility provided with the .NET Framework. My solution is ingenious, isn't it? :cool:

    M M 2 Replies Last reply
    0
    • M MrEyes

      Its not so much about obsfucating the code The situation I am in is that I have a helper DLL that does alot of work with XML for an application I produced. The company I work for has found out that other companies are using the public interface of this DLL to perform processing on their own data. Obviously we want to stop this, but would prefer to keep the exe and helper dll seperate as it is also used by other applications. The only solution I can think of, is as you suggested, some type of session/ticket validation but before embarking on that project I was wondering if there was another way post.mode = postmodes.signature; SELECT everything FROM everywhere WHERE something = something_else; > 1 Row Returned > 42

      R Offline
      R Offline
      Robert Rohde
      wrote on last edited by
      #6

      MrEyes wrote: The company I work for has found out that other companies are using the public interface of this DLL to perform processing on their own data. And your company doesn't have any lawyers to stop this? If you already know it why not bring those other companies to court?

      M 1 Reply Last reply
      0
      • J Judah Gabriel Himango

        Use an obfuscating tool after deployment. I also know of an application from Microsoft Research that will merge all your .NET assemblies into a single assembly, which can improve startup performance (as there is overhead involved in loading assemblies).

        Tech, life, family, faith: Give me a visit. I'm currently blogging about: Homosexuality in Christianity Judah Himango

        R Offline
        R Offline
        Robert Rohde
        wrote on last edited by
        #7

        You mean: IlMerge

        J 1 Reply Last reply
        0
        • D Dario Solera

          The way I'm going to explain is a little crazy... You can mask the DLL with some other filename (such as Filename.dat) and crypt it with, for example, a 3DES algorithm (provided in .NET Framework!). After this a some kind of bootstrapper is needed to decrpyt, rename, install the DLL in the GAC and start the main application. When the application is closed, the boostrapper removes the DLL from the GAC. to install the DLL in the GAC you can use the utility provided with the .NET Framework. My solution is ingenious, isn't it? :cool:

          M Offline
          M Offline
          MrEyes
          wrote on last edited by
          #8

          to install the DLL in the GAC you can use the utility provided with the .NET Framework. This I am curious about, I wasnt aware that it was possible to control the GAC programmatically. Can you post up some more information post.mode = postmodes.signature; SELECT everything FROM everywhere WHERE something = something_else; > 1 Row Returned > 42

          D 1 Reply Last reply
          0
          • R Robert Rohde

            MrEyes wrote: The company I work for has found out that other companies are using the public interface of this DLL to perform processing on their own data. And your company doesn't have any lawyers to stop this? If you already know it why not bring those other companies to court?

            M Offline
            M Offline
            MrEyes
            wrote on last edited by
            #9

            And your company doesn't have any lawyers to stop this? If you already know it why not bring those other companies to court? Without get into the meat of the issue, the problem is highly political as we have "relationships" with these third parties. I have been directed from above to find a solution to the problem without going down the lawyer route. post.mode = postmodes.signature; SELECT everything FROM everywhere WHERE something = something_else; > 1 Row Returned > 42

            1 Reply Last reply
            0
            • R Robert Rohde

              You mean: IlMerge

              J Offline
              J Offline
              Judah Gabriel Himango
              wrote on last edited by
              #10

              Yup.

              Tech, life, family, faith: Give me a visit. I'm currently blogging about: Homosexuality in Christianity Judah Himango

              1 Reply Last reply
              0
              • M MrEyes

                Hopefully I am missing the point here, I have a simple question about public functions/classes Lets says I create Widget application X, due to the complexity of the application the design dictates that some of the functionality should be farmed out into various DLLs. So now I have: MainWidgetApp.exe WidgetHelper.dll WidgetHelper.dll has various Public functions/class that can be referenced by the main app. Once this setup gets deployed out into the real world there is nothing to stop another developer making a reference to the public functions/classes in the DLL. So the question is how can I stop this from happening whilst still being able to keep the design of an Exe dependent on various DLLs post.mode = postmodes.signature; SELECT everything FROM everywhere WHERE something = something_else; > 1 Row Returned > 42

                R Offline
                R Offline
                Roman Rodov
                wrote on last edited by
                #11

                Look into the "Licensing Components and Controls" topic of the .NET Framework Developer's Guide. Also checkout third-party licensing components, such as Aspose.License for example. I think it is free (although with no support). http://www.aspose.com/Products/Aspose.License/[^]

                1 Reply Last reply
                0
                • D Dario Solera

                  The way I'm going to explain is a little crazy... You can mask the DLL with some other filename (such as Filename.dat) and crypt it with, for example, a 3DES algorithm (provided in .NET Framework!). After this a some kind of bootstrapper is needed to decrpyt, rename, install the DLL in the GAC and start the main application. When the application is closed, the boostrapper removes the DLL from the GAC. to install the DLL in the GAC you can use the utility provided with the .NET Framework. My solution is ingenious, isn't it? :cool:

                  M Offline
                  M Offline
                  Matt Gerrans
                  wrote on last edited by
                  #12

                  Does it really need to be in the GAC? If not, don't put it there, just do this to the assembely in the directory where your application lives. Of course, it wouldn't take a rocket scientist to capture the dll while the app is actually running, then copy it elsewhere for later use. Or even get it accidentally if the app quit under abnormal circumstances (eg. was killed with TerminateProcess()). Matt Gerrans

                  D 1 Reply Last reply
                  0
                  • M MrEyes

                    Hopefully I am missing the point here, I have a simple question about public functions/classes Lets says I create Widget application X, due to the complexity of the application the design dictates that some of the functionality should be farmed out into various DLLs. So now I have: MainWidgetApp.exe WidgetHelper.dll WidgetHelper.dll has various Public functions/class that can be referenced by the main app. Once this setup gets deployed out into the real world there is nothing to stop another developer making a reference to the public functions/classes in the DLL. So the question is how can I stop this from happening whilst still being able to keep the design of an Exe dependent on various DLLs post.mode = postmodes.signature; SELECT everything FROM everywhere WHERE something = something_else; > 1 Row Returned > 42

                    L Offline
                    L Offline
                    lmoelleb
                    wrote on last edited by
                    #13

                    Walk up the stack trace and have a look at the assemblies. If you do not find a call from your (signed) main executable, then throw an exception. Obviously won't stop anyone from decompiling, remove your check, then compiling again but it's a start.

                    1 Reply Last reply
                    0
                    • M MrEyes

                      to install the DLL in the GAC you can use the utility provided with the .NET Framework. This I am curious about, I wasnt aware that it was possible to control the GAC programmatically. Can you post up some more information post.mode = postmodes.signature; SELECT everything FROM everywhere WHERE something = something_else; > 1 Row Returned > 42

                      D Offline
                      D Offline
                      Dario Solera
                      wrote on last edited by
                      #14

                      The utility name is gacutil.exe, you can find it via-code in %windir%\Microsoft.NET\Framework\v1.1.4322\gacutil.exe to install an assembly in the GAC use the command gacutil /i "Assembly Path" for example gacutil /i "D:\Projects\MyPrj\Release\bin\MyLib.dll" to remove it gacutil /u AssemblyName for example gacutil /u "MyLib.dll" It isn't complicated. To improve performances you can install the assembly in the GAC with the ngen.exe (you can find it in the same directory of gacutil) utility. That program translates the assembly in a native image (i.e. an exe or dll file containing only machine-level code). To di this, use the command: ngen "Assembly Path" for example ngen "D:\Projects\MyPrj\Release\bin\MyLib.dll" to remove it you can use ngen and gacutil both. the first way is ngen /delete MyLib.dll the second one is gacutil /u MyLib.dll to run those commands via-code (C#) System.Diagnostic.Process.Start("Exe Path", "Arguments); To avoid console is shown, you should learn more about Process class. I hope I've been helpful.

                      1 Reply Last reply
                      0
                      • M Matt Gerrans

                        Does it really need to be in the GAC? If not, don't put it there, just do this to the assembely in the directory where your application lives. Of course, it wouldn't take a rocket scientist to capture the dll while the app is actually running, then copy it elsewhere for later use. Or even get it accidentally if the app quit under abnormal circumstances (eg. was killed with TerminateProcess()). Matt Gerrans

                        D Offline
                        D Offline
                        Dario Solera
                        wrote on last edited by
                        #15

                        the problem is that you cannot copy assemblies from the GAC because it is not a phisical directory! go to %windir%\assembly\GAC and try to copy a file from there. Use the command prompt also.

                        M 1 Reply Last reply
                        0
                        • D Dario Solera

                          the problem is that you cannot copy assemblies from the GAC because it is not a phisical directory! go to %windir%\assembly\GAC and try to copy a file from there. Use the command prompt also.

                          M Offline
                          M Offline
                          Matt Gerrans
                          wrote on last edited by
                          #16

                          Wanna bet? You just need to know where to look. Anyway I don't think any directory is a physical directory. Nothing in software is "physical." Of course, there are physical magnetic dipoles that are pointing in one direction or another, or transistors that have in particular electrical states and those are physical properties, but the concepts of files and directories are more metaphorical than physical. Matt Gerrans

                          D 1 Reply Last reply
                          0
                          • M Matt Gerrans

                            Wanna bet? You just need to know where to look. Anyway I don't think any directory is a physical directory. Nothing in software is "physical." Of course, there are physical magnetic dipoles that are pointing in one direction or another, or transistors that have in particular electrical states and those are physical properties, but the concepts of files and directories are more metaphorical than physical. Matt Gerrans

                            D Offline
                            D Offline
                            Dario Solera
                            wrote on last edited by
                            #17

                            I tried to go to %windir%\assembly with windows explorer, and it doesn't allow you to copy assemblies. I tried to go to the same dir with the command prompt, and the 'dir' command lists some assemblies (without extension!), but the 'copy' command doesn't work. So... [ITA] Tozzi ha ragione: Gaia si sta liberando di noi. [ENG] Tozzi is right: Gaia is obliterating us.

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups