StrongNameIdentityPermission (C++)

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?
 
T

Tomas Restrepo \(MVP\)

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")]
 
G

Guest

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! :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top