security exception *strongnameidentity*asp.net



Hi have created a class library application and is signed with
strongname (snk) .One of the public method has docorated with
strongnameidentitypermission keyword and s given below


public string Getcaspolcontrol()
{
//SHA1Managed obj=new SHA1Managed();
//FileStream str=new
FileStream(@"\pubkey.pk",FileMode.OpenOrCreate);// Stream();
//byte[] keybyte= obj.ComputeHash(str);OR
byte[] keybyte= { 0, 36, 0, 0, 4, 128, 0, 0, 148, 0, 0, 0, 6, 2, 0, 0,
0, 36, 0, 0, 82, 83, 65,49, 0, 4, 0, 0, 1, 0, 1, 0, 93, 19, 63, 112,
56, 244, 209, 42, 240, 246, 119, 4, 22, 245, 116, 206, 101, 99, 122,
61, 180, 54, 187, 104, 91, 241, 13, 119, 165,96, 211, 149, 248, 193,
55, 53, 146, 54, 222, 117, 220, 215, 212, 245, 231, 219, 227, 68, 58,
251, 238, 140, 102, 102, 239, 189, 254, 121, 130, 132, 49, 237, 117,
170, 48, 246, 234, 124, 200, 199, 28, 86, 233, 76, 44, 25, 251, 150,
73, 186, 175, 11, 23, 167, 233, 115, 139, 124, 234, 96, 129, 26, 36,
165, 208, 119, 7, 105, 84, 252, 116, 173, 208, 98, 121, 151, 196, 100,
119, 22, 195, 206, 132, 99,104, 80, 161, 221, 103, 2, 169, 185, 11,
236, 149, 58, 164, 170 };
Version v1 = new Version("1.0.0.0");
StrongNamePublicKeyBlob blob=new StrongNamePublicKeyBlob(keybyte);
string strs=ComparePublicKeys()?"two assembly has same keys":"diff
assemblies";
StrongNameIdentityPermission idper=new
StrongNameIdentityPermission(blob,"WebCtrldll",v1);
idper.Demand();
return "success";
}

-----------------
in the webapp , i simply call the method by creating instances
(Assemblyinfo is powered with same snk file)
-------------------
please tell me what should be the strong name(WebCtrldll) value
--------------------

I then cerated a web application that references the above class
library .It is also has the same same name signed with sn command .
-********
I also understand that if i extract the pubkey using sn -Tx ,both the
library file and the web app has same public key token . But , while
debugging the class library says the calling assembly as

mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089

which is different .I am confused ...why the publickey token of an
assembly is different between sn -Tp and in debug mode ..


Please guide me where i went wrong .


Regards
Raghuraman.C

.



Relevant Pages

  • Re: Assembly security
    ... StrongNameIdentityPermission is ignored in full trust. ... found that i can use strongly named assemblies for this purpose ... library with LinkDemand option and the public key of consumer ... consumers of class library should be signed with same key file. ...
    (microsoft.public.dotnet.security)
  • RE: StrongNameIdentityPermission Problem
    ... nothing is going to stop them from swapping out the Microsoft CLR with another version that doesn't have a security system ... I wrote a blog entry a few months back on the dangers of delay signed assemblies which may relate here. ... The StrongNameIdentityPermission class seems to fit in here very well. ... >that public key. ...
    (microsoft.public.dotnet.security)
  • RE: Protecting assemblies from being used outside a company/group/team
    ... As I feared, yeah, there is no bulelt proof protection if my application ... will be locally installed in the client machines. ... Just for the sake of knowledge: yeah there is a way to "assign" a PublicKey ... > protecting our assemblies from being used by other people. ...
    (microsoft.public.dotnet.security)
  • Re: Can Signatures be removed?
    ... protection by confirming that the calling code is in a particular ... calling assemblies and users don't have elevated permissions on the system, ... > assembly using Signatures and the StrongNameIdentityPermission Attribute I ...
    (microsoft.public.dotnet.security)
  • Re: Protecting assemblies from being used outside a company/group/team
    ... > protecting our assemblies from being used by other people. ... and using a LinkDemand for the PublicKey in all the assemblies ... The usual means for adding some protection against unintended use of the ... use of identity permission verifications should not be excluded ...
    (microsoft.public.dotnet.security)