473,569 Members | 2,752 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

StrongNameIdent ityPermission Permission

Hi

I am trying to protect a class from being used by anything other than the application for which it was intended with StrongNameIdent ityPermission using declarative code access security

In my solution, I have a Windows Forms Project called MainApp which I have signed with a strong name key. I also have a Class Library Project called CallClass, which I have signed with the same key

CallClass contains one class called MyClass which is coded as follows :

[StrongNameIdent ityPermission(S ecurityAction.L inkDemand, PublicKey="<pub lic key>", Name="MainApp.e xe", Version="1.0.0. 0")
public class MyClas

public MyClass(

public static string LogonSucceed(

return "This message indicates the logon process succeeded."

I obtained the public key by running sn -Tp against the .snk file

MainApp has a reference to CallClass, and contains 1 Win Form called MainForm. The Load Event for MainForm is coded as follows :

private void MainForm_Load(o bject sender, System.EventArg s e

try

MessageBox.Show (MyClass.LogonS ucceed())

catch (SecurityExcept ion ex

MessageBox.Show ("MyClass is unavailable. " + ex.Message)
Application.Exi t()

When I run this app in VS.NET 2003, I receive the following error :
Request for the permission of type System.Security .Permissions.St rongNameIdentit yPermission, mscorlib, Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= <public key token> failed

Note that the stack trace for the exception and manual tracing indicate that the exception occurs before any code within MainForm_Load is actually run

My understanding is that an exception will occur when you specify a Security Action of Demand in the attribute, because a full stack walk is performed and all callers, all the way back to mscorlib are expected to have been signed with the same strong name key

However, I am using LinkDemand, which should only require the immediate caller to be signed with the key

Note that I have also posted this one to the dotnet.security group. But I thought I'd post it here too just in case

Any help you could provide to solve this problem would be much appreciated

Thanks
David Riddiford

Nov 16 '05 #1
0 1126

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4355
by: Chris | last post by:
I have seen the posts on various places on the internet about .NET framework mismatch issues and I don't think that is my problem. ; ) When I execute the following C++.NET code: String *ipAddress = S""; IDictionary *server_config = dynamic_cast<IDictionary*>(ConfigurationSettings::GetConfig("ServerAddress") ); ipAddress =...
0
1307
by: Bnaya | last post by:
I'm invoking the same Dll from Console application and WinForm application Both signed with SrongName. the class that I'm invoking is protected with StrongNameIdentityPermission Demand
12
2496
by: Russ | last post by:
Hello. My new dev machine is running XP Pro. In the past all equipment has only used Windows 2000. I have had a lot of problems getting my projects up and running on the new machine. The current one is a permission error. The project is a VC++ Web Service. It works fine when the service is hosted on the old W2K dev machine, but on the...
2
1845
by: James Hadwen | last post by:
I'm not sure whether I'm doing something wrong, or StrongNameIdentityPermission just doesn't work in 2.0 beta 2 yet. public class Class1 { public Class1() { System.Diagnostics.Debug.Assert(Assembly.GetCallingAssembly().GetName().GetPublicKey().Length != 0);
2
1557
by: | last post by:
I am having a little bit of trouble with the syntax using attributes in classes. The compiler always complaints (VC ++ 2002) on StrongNameIdentityPermission. :-( The intention is secure my class so that it can only be inherited and instantiated by software that has the strong key of my company. A webcast suggested something like this. ...
6
2997
by: Brad | last post by:
I've just used StrongNameIdentityPermission at the class level and it works fine. Can I use it similar to the following for the entire assembly? <StrongNameIdentityPermission(SecurityAction.LinkDemand, PublicKey:="00...")> Rather than protect each class idependently I'd prefer to protect the entire assembly from being accessed by an...
0
995
by: Simon Hart | last post by:
I can't seem to get this to work. I have applied the above attribute to a class library thats installed in the GAC. I am trying to use this shared assembly from a C# ASP.NET web form, but I am getting a SecurityException: Request for the permission of type System.Security.Permissions.StrongNameIdentityPermission, mscorlib,...
0
1029
by: archana | last post by:
Hi all, I am having application in 2003 where i have one class library and two console application. In class library i have one class to which i set strongnameidentitypermission. When i try to use this class in first console application which is having same publickkey as i set in strongnameidentiypermission it works. and for second...
2
2146
by: Ares Chen | last post by:
Hi, all In .NET 1.1, I can protect my assembly by use "StrongNameIdentityPermission", so only the caller with the special StrongName Sign can call my functions in the important assembly. But how can I do this with .NET 2.0? I find some detail with this topic from a link as below...
0
7609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7921
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8118
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6278
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.