RE: StrongNameIdentityPermission LinkDemand error "mscorlib" ??

From: Abelardo Vacca (AbelardoVacca_at_discussions.microsoft.com)
Date: 02/01/05


Date: Tue, 1 Feb 2005 05:05:02 -0800

Ok, I found out my problem, so I am going to answer myself.

The command "sn -tp myKey.snk" was not actually returning the public key.

To get the public key I had to extract the public key first:
sn -p myKey.snk myPublicKey.snk

And then visualize the public key like this:
sn -tp myPublicKey.snk

I still do not know why this procedure returns a different public key than
using the original command: sn -tp myKey.snk
I find it odd specially since it is documented this way on the OReilly .NET
Security book (page 22), I wonder if I misunderstood the book or if it is
their mistake.

Thank you
"Abelardo Vacca" wrote:

> Hello,
>
> I am new to CAS.
>
> I am trying to protect my assemblies so they cannot be called by other
> assemblies not signed by our company.
>
> I create a company key pair using: sn -k myKey.snk
> I read the public key with: sn -tp myKey.snk
> I demand ask for StrongNameIdentityPermission before the class to protect
> like this:
> [StrongNameIdentityPermission(SecurityAction.LinkDemand, PublicKey:="4353bb
> ... whatever ... 423a")]
>
> But then I get a Security Exception when running the application:
> Request for the permission of type
> System.Security.Permissions.StrongNameIdentityPermission, mscorlib,
> Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
>
> Is mscorlib calling calling my class?
> Why am I getting this error
>
> I tried to follow a previous topic by Carel Lotz, he had exactly the same
> problem... but I did not find any solution there.
>
> Help please
>
>



Relevant Pages

  • Re: managed c++ assemblies
    ... I want to make a script to change the security policy to full trust ... for assemblies signed with a public key ... > Alternatively, if you'd like to use caspol, the command line is going to ...
    (microsoft.public.dotnet.security)
  • Re: [SLE] Kmail / GPG problem....
    ... >> I've got a key set up under GPG that works at the command line. ... _please_ export your public gpg key to one of the key servers. ... you still can't get your public key exported, _please_ refrain from signing ...
    (SuSE)
  • Re: Disable SSH authentication
    ... I think the goal could be achived with a different aproach, chaosonou wants "the ability to run a command on trusted machine remotely" + "don't need to either provide user account or the public key". ... This seems that he/she wants to automate or mechanize the ssh session, this could be achieved, without reinventing the wheel, using expect ...
    (SSH)
  • Re: how to determine WAN IP address from behind a NAT router?
    ... but it just dumps everything to the command line ... > But I don't want to rely on an external website. ... You can get my public key from any of the ...
    (Debian-User)
  • Re: [SLE] pgp howto
    ... > Assuming you have already imported the public key: ... gpg: Can't check signature: public key not found ... Using the gpg --edit-key UID command for the key that needs to be signed you ...
    (SuSE)

Quantcast