Code access protection

  • Thread starter Thread starter maxim
  • Start date Start date
M

maxim

Hi everyone,

We develop a GUI application and Class Library. Both are written in C#.
The Class Library has public interfaces with a lot of functionality,
which can be accessed from our GUI application, but also from any other
developer who using our product. There are a couple of fucntions in this
Class Library that we want to hide (or at list to protect) from other
developers. Those functions are for our internal usage only. I mean we
want that the only who can call them is our GUI application.

Is there any way to do that?

Thanks,
Maxim.
 
Maxim,

You can definitely do this. What you would have to do is give your
client application a strong name. Once you do that, you can get the public
key token for the strong name (using the secutil.exe tool) and then apply
the following attribute to your methods:

[StrongNameIdentityPermission(SecurityAction.LinkDemand, PublicKey = "value
from secutil.exe")]
public void MyFunction()
{
...
}

However, this will mean that all of the assemblies that the client
references needs to be strong named as well.

Hope this helps.
 
Thank you Nicholas. I will try to do it.





Nicholas Paldino said:
Maxim,

You can definitely do this. What you would have to do is give your
client application a strong name. Once you do that, you can get the public
key token for the strong name (using the secutil.exe tool) and then apply
the following attribute to your methods:

[StrongNameIdentityPermission(SecurityAction.LinkDemand, PublicKey = "value
from secutil.exe")]
public void MyFunction()
{
...
}

However, this will mean that all of the assemblies that the client
references needs to be strong named as well.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hi everyone,

We develop a GUI application and Class Library. Both are written in C#.
The Class Library has public interfaces with a lot of functionality,
which can be accessed from our GUI application, but also from any other
developer who using our product. There are a couple of fucntions in this
Class Library that we want to hide (or at list to protect) from other
developers. Those functions are for our internal usage only. I mean we
want that the only who can call them is our GUI application.

Is there any way to do that?

Thanks,
Maxim.
 
Thank you Nicholas I will try this.

Nicholas Paldino said:
Maxim,

You can definitely do this. What you would have to do is give your
client application a strong name. Once you do that, you can get the public
key token for the strong name (using the secutil.exe tool) and then apply
the following attribute to your methods:

[StrongNameIdentityPermission(SecurityAction.LinkDemand, PublicKey = "value
from secutil.exe")]
public void MyFunction()
{
...
}

However, this will mean that all of the assemblies that the client
references needs to be strong named as well.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hi everyone,

We develop a GUI application and Class Library. Both are written in C#.
The Class Library has public interfaces with a lot of functionality,
which can be accessed from our GUI application, but also from any other
developer who using our product. There are a couple of fucntions in this
Class Library that we want to hide (or at list to protect) from other
developers. Those functions are for our internal usage only. I mean we
want that the only who can call them is our GUI application.

Is there any way to do that?

Thanks,
Maxim.
 
Back
Top