473,491 Members | 2,636 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Problems securing a component with LinkDemand.

Hi folks,

I have the following situation:

- MyApplication.exe is an WinForms-application that is signed with
"AppKey.snk".
- MyControls.dll contains a MyComponent-class that I want to drop on a form
on the application. This assembly is signed with "ControlsKey.snk"

I don't want anyone else using the control from MyControl.dll except
MyApplication.exe, or any other application that would be signed with
"AppKey.snk".

Browsing through the newsgroups via Google, I got the understanding
StrongNameIdentityPermission with LinkDemand-action would be the way to go,
as that would require the immediate caller of MyComponent-class (which
should be MyApplication) to be signed with a specfic key-pair. So I have
done the declarative security on MyComponent-class like this:

<StrongNameIdentityPermission(SecurityAction.LinkD emand, _
PublicKey:="00240000048000009400000006020000002400 0052534131000400" & _
"0001000100bfb4cb9b5d7c4d678b835fafd56d6bdba74774d 3c5f6" & _
"38f2261885275fabefd93be9f7c5a5f4c7e1802313185263e ff0f5" & _
"23f4f6e54e4fd38375ab64257fe484609d237a6508746faa9 f929a" & _
"03eac98c6297955e8649bf3a660c2f1a2117001699d42ca00 b572a" & _
"d69a005de4141273bbc93fbe670e101be349076074facc5fb 6")> _
Public Class MyComponent
Inherits System.ComponentModel.Component
.....etc...

The Hex-string contains the public key from AppKey.snk.

Here is the problem: When I run my MyApplication I always get an exception
on the "InitializeComponent"-call on my application, i.e. in the designer
generated constructor:

Public Sub New()
MyBase.New()
Try

'This call is required by the Windows Form Designer.
InitializeComponent() <-- Debugger stops here, if "break on
exception" is on.

'Add any initialization after the InitializeComponent() call
Catch ex As Exception
Windows.Forms.MessageBox.Show(ex.Message, "Exception")
End Try

End Sub

The exception message is:
"Request for the permission of type
System.Security.Permissions.StrongNameIdentityPerm ission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
failed."

And stacktrace is:
" at MyApplication.MainForm.InitializeComponent()
at Myapplication.MainForm..ctor() in
C:\Work\MyApplication\Source\MainForm.vb:line 23"

Now why does that happen? I would understand if I would use Demand-action on
the permission but why can't I get the LinkDemand to work? Should I do some
declarative stuff on MyApplication as well?

Regards,
- Petri
Jul 21 '05 #1
0 1188

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

Similar topics

17
4731
by: David McNab | last post by:
Hi, I'm writing a web app framework which stores pickles in client cookies. The obvious security risk is that some 5cr1p7 X1ddi35 will inevitably try tampering with the cookie and malforming...
7
2080
by: Grant | last post by:
Ok I have XP Pro and recently upgraded to SP2 but after doing so one of my favorite webpages to check daily does not respond the same as before. It used to be (pre SP2) that I could when visiting...
2
1596
by: James | last post by:
What's the best way of securing online databases and web services? At present I am using a database password, which of course is not hard-coded into the web service, but this means re-submitting it...
1
1614
by: fred | last post by:
hi, does anybody know why this code does not raise a SecurityException? using System; using System.Security.Permissions; using System.Security; namespace MyNameSpace
11
3402
by: Wm. Scott Miller | last post by:
Hello all! We are building applications here and have hashing algorithms to secure secrets (e.g passwords) by producing one way hashes. Now, I've read alot and I've followed most of the advice...
1
2266
by: Shiro | last post by:
Hi I have read the various postings relating to Interop strong name signing and cannot find an example similar to mine. I have stringly named my AxInterops/Interops and they all work just...
7
1305
by: Nick Gilbert | last post by:
Hi, As part of a website (ASP.NET) we're creating, we need the ability to store documents with pretty much 'mission critical' security. ie, if the server is completely compromised (eg a...
0
707
by: Petri J. Riipinen | last post by:
Hi folks, I have the following situation: - MyApplication.exe is an WinForms-application that is signed with "AppKey.snk". - MyControls.dll contains a MyComponent-class that I want to drop on...
1
3376
by: Mark Goosen | last post by:
Hi ive installed wse 2.0 SP3 and was running throught the demo downlaoded on the Securing the Username Token with WSE 2.0 page the Securing the Username Token with WSE 2.0. Im spose to change...
0
7112
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,...
0
6974
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...
1
6852
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7356
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...
1
4878
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...
0
4573
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...
0
3084
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...
0
3074
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
628
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.