473,503 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Restricting access to Assembly.LoadFrom call within an assembly based on strong names

Hi,

I use the Assembly.LoadFrom call in my code to load assemblies dynamically.
This call currently loads both signed and unsigned assemblies.
It now needs to be changed to load only signed assemblies. Again only those
signed assemblies with known public keys need to be loaded.
Is there an easy way to implement this?

Regards
Surya

Nov 15 '05 #1
3 2845
Surya,

You aren't going to be able to do this. You are going to have to
implement a load mechanism yourself and then have all of your code go
through that mechanism.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"surya" <su************************@honeywell.com> wrote in message
news:Ou**************@TK2MSFTNGP10.phx.gbl...
Hi,

I use the Assembly.LoadFrom call in my code to load assemblies dynamically. This call currently loads both signed and unsigned assemblies.
It now needs to be changed to load only signed assemblies. Again only those signed assemblies with known public keys need to be loaded.
Is there an easy way to implement this?

Regards
Surya

Nov 15 '05 #2
Nicholas,

Thanks for the reply.

Can I get the public key of a signed assembly at runtime using the Evidence
of the assembly? This would help in determining whether the assembly can be
trusted.

Regards
Surya

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:uG**************@TK2MSFTNGP12.phx.gbl...
Surya,

You aren't going to be able to do this. You are going to have to
implement a load mechanism yourself and then have all of your code go
through that mechanism.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"surya" <su************************@honeywell.com> wrote in message
news:Ou**************@TK2MSFTNGP10.phx.gbl...
Hi,

I use the Assembly.LoadFrom call in my code to load assemblies

dynamically.
This call currently loads both signed and unsigned assemblies.
It now needs to be changed to load only signed assemblies. Again only

those
signed assemblies with known public keys need to be loaded.
Is there an easy way to implement this?

Regards
Surya


Nov 15 '05 #3
Surya,

You can get this by using the Assembly class instance that represents
the Assembly. The Name property will expose an AssemblyName instance. From
there, you can call the GetPublicKey method on the AssemblyName instance and
get the key.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"surya" <su************************@honeywell.com> wrote in message
news:OY*************@TK2MSFTNGP10.phx.gbl...
Nicholas,

Thanks for the reply.

Can I get the public key of a signed assembly at runtime using the Evidence of the assembly? This would help in determining whether the assembly can be trusted.

Regards
Surya

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:uG**************@TK2MSFTNGP12.phx.gbl...
Surya,

You aren't going to be able to do this. You are going to have to
implement a load mechanism yourself and then have all of your code go
through that mechanism.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"surya" <su************************@honeywell.com> wrote in message
news:Ou**************@TK2MSFTNGP10.phx.gbl...
Hi,

I use the Assembly.LoadFrom call in my code to load assemblies

dynamically.
This call currently loads both signed and unsigned assemblies.
It now needs to be changed to load only signed assemblies. Again only

those
signed assemblies with known public keys need to be loaded.
Is there an easy way to implement this?

Regards
Surya



Nov 15 '05 #4

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

Similar topics

0
933
by: Michael | last post by:
Hi, I have an assembly that has a strong name against it and in this assembly I have a method that will create instance of other classes, within the same assembly, and call a method. I use...
0
1610
by: surya | last post by:
Hi, I am using Assembly.LoadFrom within a web service to load assemblies from a web site. This web site is in the same machine where I am running the web service. The...
2
2884
by: Mário Sobral | last post by:
Hi, I created an assembly (let's call it assembly (B)) that returns a localized resource for a given key (similar to System.Globalization.ResourceManager). I checks if the caller assembly (let's...
3
1300
by: Leonardo D'Ippolito | last post by:
Hello sirs, I am trying to understand how strong names work. Suppose I have lib.dll (a .net library), and also MyApplication.exe (a .NET WinApp) . MyApplication uses lib.dll . Suppose someone...
1
1443
by: Jimski | last post by:
Hi all, I am creating an assembly that will access a database to return record details. I need to deploy it to a 3rd Party and they will then be able to use the assembly in their code to...
0
1606
by: Oenone | last post by:
I have created a number of "plug-in" DLLs for my ASP.NET application which are dynamically loaded at run-time. This is done by locating the DLL file on disk and loading it using the...
3
1578
by: Mark Keogh | last post by:
Hi, Why is everything some confusng when MS are involved ;-) Anyway, I have my excel export routines working fine, now when I try to build them into my assembly, which has a strong name, I get...
14
4458
by: Nak | last post by:
Hi there I'm trying to use the Microsoft Web Browser within a strong names .NET assembly that I have written. Unfortunately I am getting the following linker problem as the Interop DLL that was...
4
1368
by: James | last post by:
Hi, I have just upgraded a user machine to Vista (our first) as a test. Unfortunately a couple of our apps are failing due to Vista... 1. One app that loads an assembly from an Intranet...
0
7201
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
7083
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...
0
7278
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,...
0
4672
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
3166
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
3153
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1510
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 ...
1
734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
379
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...

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.