Re: NUnit and StrongnameIdentityPermission

From: Carel Lotz (CarelLotz_at_discussions.microsoft.com)
Date: 07/27/04


Date: Tue, 27 Jul 2004 10:10:04 -0700

Mmm,

I had a look at the sample and it leaves me feeling a bit uncomfortable. Don't really like the idea of doing the stack walk in code. Is this the only alternative? Is there nothing like a policy file/key list file that I can compile into my application to indicate to CAS to skip the check for assemblies signed with the public keys within the list?

The whole CAS thing is breaking the automated build process - can't run unit tests via NUnit, can run documentation generation via NDoc as these all are "untrusted" assemblies and throw SecurityExceptions. Aarrghhh, this is like a catch 22. If I want to automate the build I need to remove the FullTrust Demand, but If I want to secure the framework I need to include it. I'm thinking about compiler directives but that alternative also leaves me unsatisfied. Any other ideas would be helpful.

-- 
Carel Lotz
"I want to code till I die" - Robert C. Martin
"Carel Lotz" wrote:
> Thanks Nicole
> 
> I meant full trust demands.  I'll have a look at the blog sample
> 
> -- 
> Carel Lotz
> "I want to code till I die" - Robert C. Martin
> 
> 
> "Nicole Calinoiu" wrote:
> 
> > Carel,
> > 
> > If you are using link demands instead of full stack demands, this shouldn't 
> > be an issue if you sign your test assembly with the same signing key.  If 
> > you're using full demands, either one of the following might be an option:
> > 
> > 1.  Re-compile NUnit from its source (available in the NUnit install 
> > directory) after signing it with your own key.
> > 2.  Instead of using full demands, test that each caller in the stack is 
> > signed with any one of multiple acceptable keys from your own code.  An 
> > example of this approach is available at 
> > http://blogs.msdn.com/Eugene_Bobukh/archive/2004/03/10/87603.aspx.
> > 
> > #1 would probably be a lot less work if you're already well into 
> > implementing your project.
> > 
> > HTH,
> > Nicole
> > 
> > 
> > "Carel Lotz" <CarelLotz@discussions.microsoft.com> wrote in message 
> > news:32CEAAE9-8055-4C73-ADD2-1993693009E4@microsoft.com...
> > > Hi
> > >
> > > We have created a framework of components for use only within our company 
> > > and have therefore added StrongNameIdentityPermission with LinkDemands to 
> > > our company's key on the public interfaces of some of the assemblies. 
> > > This all works fine however we have run into a problem when executing the 
> > > unit tests for the assemblies as a caller within the call chain is now 
> > > NUnit itself.  This brings about the permission error.
> > >
> > > How do I get our assemblies to automatically trust NUnit as a caller?
> > >
> > > Thanks
> > > -- 
> > > Carel Lotz
> > > "I want to code till I die" - Robert C. Martin 
> > 
> > 
> > 


Relevant Pages

  • Re: NUnit and StrongnameIdentityPermission
    ... I meant full trust demands. ... Re-compile NUnit from its source (available in the NUnit install ... > "Carel Lotz" wrote in message ... >> our company's key on the public interfaces of some of the assemblies. ...
    (microsoft.public.dotnet.security)
  • Re: StrongNameIdentityPermission error
    ... The assemblies calling the 'secured' assemblies are all signed using the same key. ... "Fernando Vicaria " wrote: ... > "Carel Lotz" wrote in message ... >>> just a "short version" of the actual public key blob. ...
    (microsoft.public.dotnet.security)
  • Re: StrongNameIdentityPermission error
    ... All my assemblies are signed with the same key. ... "Fernando Vicaria " wrote: ... > "Carel Lotz" wrote in message ... >>>>> file and then use a HexEditor to view it. ...
    (microsoft.public.dotnet.security)
  • Re: StrongNameIdentityPermission error
    ... binary representation of the public key alone (obtained from the key pair as ... >> We want to secure these assemblies by requesting a ... >> that our company uses to sign their .NET assemblies. ... >> Carel Lotz ...
    (microsoft.public.dotnet.security)