How to protect license


#1

Dear all , I would like to protect our Aspose.Total license , Could you sent me the sample code?

Many thanks.


#2

@itritw,

Thanks for contacting support.

The better approach to protect license file is to keep it stored in safe location but in case you need to distribute the license file with application deployment, then you may consider using license file as an embedded resource. Please note that in order to put an extra layer of security when embedding the license with application, you can compress/encrypt license and after that you can embed it into assembly. A free utility DotNetZip (http://dotnetzip.codeplex.com/) can help to fulfill this requirement. Suppose we have Aspose.Total.lic license file, so let’s make Aspose.Total.lic.zip with password test and embed this zip file into solution. The following code snippet can be used to initialize the license:
[C#]

using (Stream zip = new Program().GetType().Assembly.GetManifestResourceStream("Aspose.Total.lic.zip"))
{
    using (ZipFile zf = ZipFile.Read(zip))
    {
        ZipEntry e = zf["Aspose.Total.lic"];
        e.ExtractWithPassword(ms, "test");
        ms.Position = 0;
    }
}