Re: StrongNameIdentityPermission error

From: Fernando Vicaria [MSFT] (fvicaria_at_online.microsoft.com)
Date: 06/19/04


Date: Fri, 18 Jun 2004 16:29:21 -0700

I forgot to say that "sn -tp filename" will work when the file contents is a
binary representation of the public key alone (obtained from the key pair as
I mentioned before).

"Fernando Vicaria [MSFT]" <fvicaria@online.microsoft.com> wrote in message
news:40d37887$1@news.microsoft.com...
> Hi Carel,
> What you get from "sn -tp ourPublicKey.snk" is the public key token which
> is just a "short version" of the actual public key blob. You can easily
> see the key token using ILDasm or Reflector. To get the key blob use
> "sn -p ourPublicKey.snk public.key" to export the public key blob to a
> separate file and then use a HexEditor to view it.
>
> Hope this helps.
>
> Regards,
> Fernando
>
> "Carel Lotz" <CarelLotz@discussions.microsoft.com> wrote in message
> news:09E0C8AC-F38C-4B30-A0E9-C774FECDC204@microsoft.com...
>> Hi All
>>
>> We have developed a set of technical environmental services
>> (logging,security,exception handling etc.) to be used within our company.
>> We want to secure these assemblies by requesting a
>> StrongNameIdentityPermission on all of the public classes with the key
>> that our company uses to sign their .NET assemblies. This will prevent
>> other non-trusted assemblies from using our assemblies (although I know
>> there is a way to hack the check).
>>
>> Here is a sample of the code that we use to request the permissions with:
>>
>> <StrongNameIdentityPermission(SecurityAction.Demand,
>> PublicKey:=KeyConstants.SANLAM_PUBLIC_KEY)> _
>> Public NotInheritable Class SecurityManager ...
>>
>> The KeyConstants.SANLAM_PUBLIC_KEY is a hex representation of the public
>> part of our key and was extracted using:
>>
>> sn -tp ourPublicKey.snk
>>
>> However, when we run the code we get the following exception:
>>
>> A first chance exception of type 'System.Security.SecurityException'
>> occurred in mscorlib.dll
>>
>> Additional information: Request for the permission of type
>> System.Security.Permissions.StrongNameIdentityPermission, mscorlib,
>> Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
>> failed.
>>
>> Why is this happening as the code calling the assembly is signed using
>> our company's key? If I change the SecurityAction.Demand to LinkDemand
>> everything works but that implies that another assembly can use any of
>> our company's assemblies to abuse the 'secured' assemblies. What am I
>> doing wrong?
>>
>> Thanks
>> --
>> Carel Lotz
>> "I want to code till I die" - Robert C. Martin
>
>



Relevant Pages

  • "Patching secure assemblies whose digital certificate has expired" ??
    ... which has the effect of ensuring that the set of secure assemblies have all ... been signed with our Authenticode certificate and are therefore authentic. ...
    (microsoft.public.dotnet.framework)
  • "Patching secure assemblies whose digital certificate has expired" ??
    ... which has the effect of ensuring that the set of secure assemblies have all ... been signed with our Authenticode certificate and are therefore authentic. ...
    (microsoft.public.dotnet.general)
  • Re: Adjusting security setting to run an embedded windows control in IE
    ... Just so you remember that I said this is the less secure and thus less ... The other advantage is that you can easily deploy other assemblies with the ... >> How does one go about giving an AppDomain full trust by using a URL ... >> membership condition? ...
    (microsoft.public.dotnet.security)
  • Setting up secure custom Web Controls
    ... I've read through "Building Secure MS ASP.NET Applications", ... I am building a few controls/components that will be used by another party ... my own assemblies should be able to call these 'public' methods/proprties. ... This satellite assembly will contain an Xml 'file' in a resource that only ...
    (microsoft.public.dotnet.framework.aspnet.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)

Loading