473,378 Members | 1,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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
Nov 22 '05 #1
0 704

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

Similar topics

17
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...
0
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...
7
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
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
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
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
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
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...
1
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...
4
by: KJ | last post by:
Hello All, I have to secure my first real B2B web service. Could you please provide some guidance as to which method of security I should use. One caveat is that we will not be using SSL on the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.