How to protect license


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

Many thanks.



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 ( can help to fulfill this requirement. Suppose we have Aspose.Total.lic license file, so let’s make with password test and embed this zip file into solution. The following code snippet can be used to initialize the license:

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