Strongly named dynamic assemblies

O

Ostap Radkovskiy

Hi!

I'm having problems with strongly named assemblies usage. There is a .NET
solution with number of projects signed by public/private key pair (snk).
The solution uses another package of .NET assemblies signed by another snk
and deployed as msi. Now the problem. These package assemblies have a piece
of code dynamically generating custom assembly with wrappers to a .NET
solution classes. I'm getting a TypeLoadException of "Method ... is not
implemented" while calling typeBuilder.CreateType(). If I'd remove signing
for the solution assemblies - everything works fine. I was trying to sign
dynamically generated assembly with solution's snk - same exception.

Any suggestions appreciated,

Ostap Radkovskiy
 
O

Ostap Radkovskiy

For those who's interested: this was solved by adding [assembly:
AllowPartiallyTrustedCallers] both to the solution and library package
 
M

Matt Berther

Hello Ostap,
For those who's interested: this was solved by adding [assembly:
AllowPartiallyTrustedCallers] both to the solution and library package

Another problem solved by granting excessive permissions... When will this stop?

Before you use this solution, please make sure and review Keith Brown's thoughts on APTCA (AllowPartiallyTrustedCallersAttribute) at http://msdn.microsoft.com/msdnmag/issues/03/08/SecurityBriefs/

Excerpt:
"The only time you should ever add the AllowPartiallyTrustedCallers attribute to your assembly is after a careful security audit. Be doubly wary if your assembly calls unmanaged code. As soon as you apply this attribute to a GAC-deployed assembly, you're opening that assembly up to attack from external untrusted code. Even the core .NET assemblies don't all have this attribute. For example, partially trusted code isn't allowed to use System.Runtime.Remoting.dll or System.Management.dll. The reason is that Microsoft apparently hasn't convinced itself that partially trusted code can't use these libraries to obtain elevated privileges. Only recently did ASP.NET pass examination and receive this attribute: System.Web.dll was awarded the AllowPartiallyTrustedCallers attribute in version 1.1 of the Microsoft .NET Framework."
 

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