473,651 Members | 2,917 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

StrongNameIdent ityPermission (C++)

I am having a little bit of trouble with the syntax using attributes in
classes.
The compiler always complaints (VC ++ 2002) on StrongNameIdent ityPermission.
:-(

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.

using namespace System::Securit y::Permissions;
....
[StrongNameIdent ityPermission( SecurityAction. InheritanceDema nd(
PublicKey="0024 0000048000....9 ")]
[StrongNameIdent ityPermission( SecurityAction. LinkDemand(
PublicKey="0024 0000048000....9 ")]
public __gc class Dataset : public IDisposable {
....
}

But the error I get is this:

:\Source\Scratc h\sLibv2_2\Mana ged\Projects\Sk yscanLibBase\MD ataset.h(21) :
error C3725:
'System::Securi ty::Permissions ::StrongNameIde ntityPermission Attribute':
cannot resolve attribute overload
could be
'System::Securi ty::Permissions ::StrongNameIde ntityPermission Attribute::Stro n
gNameIdentityPe rmissionAttribu te(System::Secu rity::Permissio ns::SecurityAct i
on)'

Note: The Public key is ofcourse reduced in size for this post.

Any idea how the syntax needs to be?
Nov 17 '05 #1
2 1560
Olaf,
I am having a little bit of trouble with the syntax using attributes in
classes.
The compiler always complaints (VC ++ 2002) on StrongNameIdent ityPermission. :-(

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.

using namespace System::Securit y::Permissions;
...
[StrongNameIdent ityPermission( SecurityAction. InheritanceDema nd(
PublicKey="0024 0000048000....9 ")]
[StrongNameIdent ityPermission( SecurityAction. LinkDemand(
PublicKey="0024 0000048000....9 ")]
public __gc class Dataset : public IDisposable {
...
}

Try this, instead:

[StrongNameIdent ityPermission(
SecurityAction: :InheritanceDem and,PublicKey=S "00240000048000 ....9")]
[StrongNameIdent ityPermission( SecurityAction: :LinkDemand,
PublicKey=S"002 40000048000.... 9")]

--
Tomas Restrepo
to****@mvps.org
Nov 17 '05 #2
Hi Tomas,
Try this, instead:

[StrongNameIdent ityPermission(
SecurityAction ::InheritanceDe mand,PublicKey= S"0024000004800 0..9")]
[StrongNameIdent ityPermission( SecurityAction: :LinkDemand,
PublicKey=S"00 240000048000..9 ")]


For some odd reason I cannot see your reply in the newsgroup, so I only
discovered it now through a web site, but it solved the problem!
It compiles, but I still need to test it if it does its job, when I can find
time.

(I took te original sample from C#)

Thanks for the information! :-)

Nov 17 '05 #3

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

Similar topics

1
4373
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 = dynamic_cast<String*>(server_config->get_Item(S"IP"));
0
1315
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
0
1130
by: David Riddiford | last post by:
Hi I am trying to protect a class from being used by anything other than the application for which it was intended with StrongNameIdentityPermission 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...
2
1853
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);
1
1552
by: Mythran | last post by:
I have the following setup: BLL Project Category.vb AssemblyInfo.vb Schema Project Category.xsd AssemblyInfo.vb
6
2999
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 invalid program. I tried <Assembly: StrongNameIdentityPermission(SecurityAction.LinkDemand,...
0
997
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, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed The ASP.NET is strong named with the...
0
1032
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 console application having different public key it gives me error.
2
2147
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 http://msdn.microsoft.com/en-us/library/system.security.permissions.strongnameidentitypermission.aspx In the .NET Framework versions 1.0 and 1.1, identity...
0
8357
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8277
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8803
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8700
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7298
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5612
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4285
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2701
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1588
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.