468,161 Members | 1,983 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,161 developers. It's quick & easy.

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 2703
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Michael | last post: by
2 posts views Thread by Mário Sobral | last post: by
3 posts views Thread by Leonardo D'Ippolito | last post: by
1 post views Thread by Jimski | last post: by
1 post views Thread by gcdp | last post: by
reply views Thread by kamranasdasdas | last post: by
reply views Thread by gcreed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.