473,569 Members | 2,752 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Hi,

I use the Assembly.LoadFr om 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 2853
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.co m

"surya" <su************ ************@ho neywell.com> wrote in message
news:Ou******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

I use the Assembly.LoadFr om 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.c om> wrote in
message news:uG******** ******@TK2MSFTN GP12.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.co m

"surya" <su************ ************@ho neywell.com> wrote in message
news:Ou******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

I use the Assembly.LoadFr om 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.co m

"surya" <su************ ************@ho neywell.com> wrote in message
news:OY******** *****@TK2MSFTNG P10.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.c om> wrote in message news:uG******** ******@TK2MSFTN GP12.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.co m

"surya" <su************ ************@ho neywell.com> wrote in message
news:Ou******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

I use the Assembly.LoadFr om 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 the Assembly.Load to load the assembly, but I always get the following message: Request for the permission of type
0
1631
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 Assembly.LoadFrom(httpsite) method throws a file not found exception. I used the same code within a windows based application on the same machine and it worked, so if the...
2
2888
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 call it assembly (A)) has a satellite assembly (let's call it assembly (sA)) with localized resources. If it exists, it gets the resource with the...
3
1302
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 decompiles lib.dll and replaces code parts, and then recompiles again. When MyApplication.exe will load lib.dll the next time, will it detect that...
1
1447
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 access the methods contained within the assembly. As this assembly will effectively access the database then I need to provide some security to stop...
0
1608
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 Assembly.LoadFrom(Filename) function. It's important that the DLLs are shadowed by ASP.NET so that they can be easily updated. To get this to work I have placed...
3
1585
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 the Unable to emit assembly: Referenced assembly 'Interop.VBIDE' does not have a strong name message and everything stops. Now I searched the...
14
4463
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 created does not have a strong name, "Unable to emit assembly: Referenced assembly 'Interop.SHDocVw' does not have a strong name"
4
1374
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 website now fails with FileNotFound on a call to Assembly.LoadFrom(url). This still works fine on all XP SP2 systems in the company. 2. Maybe...
0
7921
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8118
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7666
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5217
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2107
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 we have to send another system
0
936
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.