StrongNameIdentityPermission (C++)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.

using namespace System::Security::Permissions;
....
[StrongNameIdentityPermission( SecurityAction.InheritanceDemand(
PublicKey="00240000048000....9")]
[StrongNameIdentityPermission( SecurityAction.LinkDemand(
PublicKey="00240000048000....9")]
public __gc class Dataset : public IDisposable {
....
}

But the error I get is this:

:\Source\Scratch\sLibv2_2\Managed\Projects\SkyscanLibBase\MDataset.h(21) :
error C3725:
'System::Security::Permissions::StrongNameIdentityPermissionAttribute':
cannot resolve attribute overload
could be
'System::Security::Permissions::StrongNameIdentityPermissionAttribute::Stron
gNameIdentityPermissionAttribute(System::Security::Permissions::SecurityActi
on)'

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

Any idea how the syntax needs to be?
 
Olaf,
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.

using namespace System::Security::Permissions;
...
[StrongNameIdentityPermission( SecurityAction.InheritanceDemand(
PublicKey="00240000048000....9")]
[StrongNameIdentityPermission( SecurityAction.LinkDemand(
PublicKey="00240000048000....9")]
public __gc class Dataset : public IDisposable {
...
}


Try this, instead:

[StrongNameIdentityPermission(
SecurityAction::InheritanceDemand,PublicKey=S"00240000048000....9")]
[StrongNameIdentityPermission( SecurityAction::LinkDemand,
PublicKey=S"00240000048000....9")]
 
Hi Tomas,
Try this, instead:

[StrongNameIdentityPermission(
SecurityAction::InheritanceDemand,PublicKey=S"00240000048000..9")]
[StrongNameIdentityPermission( SecurityAction::LinkDemand,
PublicKey=S"00240000048000..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! :-)
 
Back
Top