Protecting Assemblies

G

Guest

Hi,

When an application is shipped is there a way of un-authroized people from using the assemblies in their own applications?

Regards,

Michael
 
P

Peter Rilling

Check out the StrongNameIdentityPermissionAttribute class. This will make
it so that only your, trusted, assemblies can bind to your assemblies. If
someone tries to reference your assemblies, they will get an exception.



Michael said:
Hi,

When an application is shipped is there a way of un-authroized people from
using the assemblies in their own applications?
 
G

Guest

Thank you for your replies.

I've had a look at the StrongNameIdentityPermissionAttribute and I'm not sure if it is work correctly. I'll tell you what I've done and maybe you can tell me where I've gone wrong.

1) Create a class library and a strong name using sn.exe
2) Modified the AssemblyKeyFile attribute on the assembly to point to the strong name file.
3) Set DelaySign to false.
4) Got the public key using "sn -o" and removed the spaces an commas.
5) Places the result of "Step 4" in a StringNameIdentityPermission attribute on the assembly with a RequestMinimum.
6) Create a UI application that referenced this assembly and attempted to use a class. This generated a PolicyException.
7) I then signed the EXE with the same strong name, Steps 2 and 3, ran it again.
8) I still got the PolicyException message.

Can you tell me where I've gone wrong? The PolicyException states that the "Required Permissions Cannot Be Aquired".

Thank you,

Michael
 
G

Guest

If I place the StrongNameIdentityPermissionAttribute at class level, then everything works fine. But it fails at assembly level.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top