473,404 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Preventing others from using my class library assembly.

I have created a class library assembly (.dll) file. At the main GUI
application, this assembly is referenced and used. But the problem is,
if I redistribute these files with my application, somebody can also
add the class library assembly to their .NET project. I would like to
prevent it because allowing it could be a security leak.

Is it possible to prevent others (than me, of course, I need to use
it) from using my class library assembly?

Jun 21 '07 #1
7 3680
"Sin Jeong-hun" <ty*******@gmail.comwrote in message
news:11**********************@q19g2000prn.googlegr oups.com...
>I have created a class library assembly (.dll) file. At the main GUI
application, this assembly is referenced and used. But the problem is,
if I redistribute these files with my application, somebody can also
add the class library assembly to their .NET project. I would like to
prevent it because allowing it could be a security leak.

Is it possible to prevent others (than me, of course, I need to use
it) from using my class library assembly?
You can add to your library a LinkDemad for a
StrongNameIdentityPermission, which should match the Strong Name of your
calling program.

This will prevent someone else from using your dll by just adding a
reference to it, but does not guarantee that no one will be able to use it.
I believe that the LinkDemand can be bypassed by using Reflection. Or they
could dissassemble and modify the assembly.
Jun 21 '07 #2
You mention that it "could be a security leak". You shouldn't hardcode any
passwords or confidential info into your dll :)
"Sin Jeong-hun" <ty*******@gmail.comwrote in message
news:11**********************@q19g2000prn.googlegr oups.com...
>I have created a class library assembly (.dll) file. At the main GUI
application, this assembly is referenced and used. But the problem is,
if I redistribute these files with my application, somebody can also
add the class library assembly to their .NET project. I would like to
prevent it because allowing it could be a security leak.

Is it possible to prevent others (than me, of course, I need to use
it) from using my class library assembly?
Jun 21 '07 #3
Sin Jeong-hun wrote:
I have created a class library assembly (.dll) file. At the main GUI
application, this assembly is referenced and used. But the problem is,
if I redistribute these files with my application, somebody can also
add the class library assembly to their .NET project. I would like to
prevent it because allowing it could be a security leak.

Is it possible to prevent others (than me, of course, I need to use
it) from using my class library assembly?
Hi,

Unfortunately there are ALWAYS ways around any security measures you try and
implement. To follow up on Alberto's post about signing the assembly, he's
absolutely right... it can be easily bypassed by decompiling your assembly
and tampering with it.

You may want to re-think your entire security strategy, if referencing and
using a class library causes a security violation.

--
Tom Spink
University of Edinburgh
Jun 21 '07 #4
Hi,

"Sin Jeong-hun" <ty*******@gmail.comwrote in message
news:11**********************@q19g2000prn.googlegr oups.com...
>I have created a class library assembly (.dll) file. At the main GUI
application, this assembly is referenced and used. But the problem is,
if I redistribute these files with my application, somebody can also
add the class library assembly to their .NET project. I would like to
prevent it because allowing it could be a security leak.
Can you elaborate why you need that?

What kind of security leaks are you talking about?
Jun 21 '07 #5
You can add to your library a LinkDemad for a
>StrongNameIdentityPermission, which should match the Strong Name of your
calling program.

This will prevent someone else from using your dll by just adding a
reference to it, but does not guarantee that no one will be able to use it.
I believe that the LinkDemand can be bypassed by using Reflection.

As of .NET 2.0 the demand will be satisfied by any fully trusted code.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Jun 21 '07 #6

"Mattias Sjögren" <ma********************@mvps.orgwrote in message
news:Oj*************@TK2MSFTNGP04.phx.gbl...
> You can add to your library a LinkDemad for a
StrongNameIdentityPermission, which should match the Strong Name of your
calling program.

This will prevent someone else from using your dll by just adding a
reference to it, but does not guarantee that no one will be able to use
it.
I believe that the LinkDemand can be bypassed by using Reflection.


As of .NET 2.0 the demand will be satisfied by any fully trusted code.
Presumably InternalsVisibleToAttribute would accomplish the same thing but
not be satisfied by FullTrust.
>

Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Jun 22 '07 #7
On Jun 22, 5:37 am, "Ignacio Machin \( .NET/ C# MVP \)" <machin TA
laceupsolutions.comwrote:
Hi,

"Sin Jeong-hun" <typing...@gmail.comwrote in message

news:11**********************@q19g2000prn.googlegr oups.com...
I have created a class library assembly (.dll) file. At the main GUI
application, this assembly is referenced and used. But the problem is,
if I redistribute these files with my application, somebody can also
add the class library assembly to their .NET project. I would like to
prevent it because allowing it could be a security leak.

Can you elaborate why you need that?

What kind of security leaks are you talking about?
The class library assembly has a method to create an installation code
and accepts hardware id values as formal parameters. If someone else
can load the dll and use the method, they can generate many
installation
code by passing different hardware id values and guess out how it
works.
(Actually, this is not a very serious authentication, I'm going to add
this
to my home-made applications)
The class library assembly is actually written with Managed C++ (I
don't
like MC++ much but I had to, because I need to get some hardware
values
such as HDD serial, MAC address...) , and I'm going to use this
assembly
in my C# applications.

Thank you for many replies, all of you experts.

Jun 22 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: ptass | last post by:
If i create a simple windows form .exe then launch it via a href, ( simple one touch deployment ), why does the .net framework/iis search in multiple places and for multiple files derived from the...
4
by: Terry | last post by:
I'm building some dll assemblies that have in them the implementation of an abstract class defined in a different assembly. I'm trying to create objects of the type defined in the dlls with...
7
by: jason | last post by:
i have a C# class library full of objects. the immediate need was to instantiate these objects in classic ASP, so i inherit ServicedComponent and build the project with COM Interop set to true....
14
by: pmud | last post by:
Hi, I need to use an Excel Sheet in ASP.NET application so that the users can enter (copy, paste ) large number of rows in this Excel Sheet. Also, Whatever the USER ENETRS needs to go to the...
1
by: Jim | last post by:
Have fully operational software package developed on VB.NET that worked until Jan 1 2003, with early stage deployments on Oct 10, Oct 23, Nov 11, Dec 12 and Dec 30. When attempted final...
3
by: Ot | last post by:
Although I think I have developed a class library properly, maybe I haven't. When I attempt to include a reference to that class library A which appears in the IDE when I click the COM tab after...
5
by: Jesper Schmidt | last post by:
When does CLR performs initialization of static variables in a class library? (1) when the class library is loaded (2) when a static variable is first referenced (3) when... It seems that...
3
by: Rich | last post by:
I put together a simple test class libary (VB2005) with one class and one function that takes an integer argument and adds 10 the argument and returns that number. Then I created a simple VB2005...
14
by: Noone | last post by:
Hello all, Ok, I want to create a program that will load plugins (dll's) from a plugin folder. I can create the forms and put them into a dll but I cannot actually add them dynamically at run...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.