Re: StrongNameIdentityPermission error
From: Fernando Vicaria [MSFT] (fvicaria_at_online.microsoft.com)
Date: 06/19/04
- Next message: John Banes [MS]: "Re: interop: PaddingMode.None TripleDES with CrptoAPI"
- Previous message: Fernando Vicaria [MSFT]: "Re: StrongNameIdentityPermission error"
- In reply to: Fernando Vicaria [MSFT]: "Re: StrongNameIdentityPermission error"
- Next in thread: Carel Lotz: "Re: StrongNameIdentityPermission error"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
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
>
>
- Next message: John Banes [MS]: "Re: interop: PaddingMode.None TripleDES with CrptoAPI"
- Previous message: Fernando Vicaria [MSFT]: "Re: StrongNameIdentityPermission error"
- In reply to: Fernando Vicaria [MSFT]: "Re: StrongNameIdentityPermission error"
- Next in thread: Carel Lotz: "Re: StrongNameIdentityPermission error"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|