Posted Wednesday, March 02, 2005 8:12 AM
|
|
|
|
IntroductionThe purpose of this topic is to demonstrate how to use .NET Matrix Library with a Developer's license without signing the main application.
.NET Matrix Library is offered in two kinds of commercial licenses: Single Machine License and Developer's License. Developer's License offers royalty free redistribution rights, it is not bound to a specific machine, it does not require any kind of registration or activation. Copying a *.LIC in the application's folder is the only thing that is required to have the application licensed to use NML.
To sign or not to signThe only limitation of a Developer's License is that it requires that the assembly using NML has to be signed. The licensing mechanism compares the public key token of the calling assembly with this stored in the license file and verifies the legal use of NML. For most developers and software companies, signing their code is a common practice and intergrading a developer's license of NML is just as simple as copying the *.LIC license file in the application folder.
There are cases though, where an application is used only internally within an organization and signing assemblies has not the same importance as when an application is distributed globally from a developer or a software house. We have met the situation where an organization had a collection of previously built unsigned assemblies that need to be used together with NML.
The question here is: Can we mix signed and unsigned assemblies? Well, yes and no. The following table describes the situation:
| | Can be referenced by | Can reference | | An unsigned assembly | Unsigned assemblies only | Either signed or unsigned | | A signed assembly | Either signed or unsigned assemblies | Signed only | | .NET Matrix Library used with a trial or a single machine license | Either signed or unsigned assemblies | | | NET Matrix Library used with a developer's license | Signed assemblies only | |
This looks like a deadlock situation. Signing the application that is to use NML makes impossible to use other unsigned assemblies. Not signing the application makes impossible to use NML with a developer's license.
The SolutionAs we can see from the previous table, an unsigned assembly can reference either signed or unsigned assemblies. Instead of directly referencing NML from our application, we may create a signed class that will reference NML and then have our main (unsigned) application to use the NML's functionality through this (signed) class.
Sample codeIn order to demonstrate the above, we have created a solution that combines two projects.
UnsignedApp is our unsigned main application that needs to use NML. It doesn't do this directly but through the use of the SignedDLL. At the same time, UsignedApp being unsigned, it can reference other unsigned assemblies too.
SignedDLL is the part of our code that is signed with our private-public key pair created by the sn utility. Being a signed assembly, it can use NML with a Developer's License and at the same time expose public methods that will be used by the UnsignedApp.
You can download the sample code from here: http://www.bluebit.gr/code/CodeSample1.ZIP
Trifon Triantafillidis | Lead Developer |
|
|
|
|
|