none
How to secure modules with digital signatures RRS feed

  • Question

  • Could anybody tell me is there any way that we can restrict the CLR not to load those .net assembles which have different Public Key than calling assembles?

     

    I am using Smart Client Software Factory/Composite Application Block and .Net Framework 2.0.  I have a shell application which loads plug-ins/modules defined in XML file i.e. ProfileCatalog.xml. My shell and all plug-ins are signed assemblies and have same public key and public key token. What I want if someone other than me attempt to load his plug-in in my shell then shell raise a security exception and don’t load it.  StrongNamePermissionAttribue with public key is not working in .Net Framework 2.0.

     

    Thanks,

    ZG

    Thursday, June 4, 2009 2:01 PM

Answers

  • StrongNameIdentityPermission does work in .NET 2.0, just not quite the same way as it did in 1.x.  The only difference in 2.0 is that assemblies with unrestricted permission grants (aka "full trust") pass demands for StrongNameIdentityPermission regardless of their actual strong names (or lack thereof).  This behaviour of StrongNameIdentityPermission should in no way prevent you from using strong name evidence to help establish a permission grant.  If you are having problems doing this, could you please post a short but complete (http://www.yoda.arachsys.com/csharp/complete.html) sample demonstrating how you are loading your plug-ins and attempting to restrict their permissions?

    BTW, since you're using .NET 2.0, you might want to consider using the simple sandboxing API (http://blogs.msdn.com/shawnfa/archive/2005/08/08/449050.aspx), which would allow you to set up your permission restrictions quite easily.

    • Marked as answer by Zhi-Xin Ye Wednesday, June 10, 2009 7:59 AM
    Friday, June 5, 2009 4:48 PM