ASP.Net, MVC, MEF and loading approved plugins (ie, plugins with known signer)

I'm working on an ASP.Net MVC/MEF based project.

Is it possible to build the catalog such that the DLLs added to the application are approved using a known signer? We don't want to load any old plugin that conforms - just those that have been approved (approving a plugin means its signed with a known key).

Jeff

Answers


You need to perform filtering like this before you initialise the MEF catalog. I.e., if you're using AssemblyCatalog:

var assemblies = // all assemblies
var catalog = new AggregateCatalog(
    assemblies
        .Where(a => IsAcceptable(a))
        .Select(a => new AssemblyCatalog(a))
);

You need to supply the IsAcceptable method to perform assembly filtering as appropriate:

bool IsAcceptable(Assembly a) { ... }

var c = X509Certificate.CreateFromSignedFile(assemblyFile);
if (c.Issuer = "Joe") ...

just an idea, didnt tried :) let us know if it works..


Need Your Help

MVC: Repopulate filters form's fields without using Model

c# asp.net-mvc asp.net-mvc-3 linq razor

I need to repopulate a form of filters, in a View in which I can't use the Model for doing so (Already using Model to bring an IEnumerable of an object, in order to create a table).

Database is throwing an InvalidOperationException status of 500 in a MVC Web Application while accessing data from an SQL View

c# sql sql-server asp.net-mvc sql-view

I am working on an Asp.Net MVC Application in which I have an SQL View with five columns and I have the following model for it

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.