I'm developing a .NET package manager and one thing that got me thinking is security.
Given that anybody can potentially upload an assembly to the repository, how do I verify that said assembly comes from a trusted source? For example, I'd trust NHibernate.dll
much more if it was signed with a private key of guys from NHForge. To ensure this, all I'd have to do is to verify assembly signature with NHForges' public key.
Now, with that in mind, how can one establish this relationship (that this particular public key belongs to this particular person)? An idea I came up with is as follows:
- Project author creates an XML file which contains information about the project and about an author (name, email, etc)
- This XML file is signed with authors' private key extracted from a
.snk
file which is later used to sign the assembly itself - Author uploads this signed XML file to the repository, where it gets checked and a relationship between an author and a public key is established
To implement this (is this a viable idea, BTW?), I need a programmatic way of accessing .snk
files and reading PK. Is there something for this in .NET?