Knowledgebase: > Users > Dan
How do I store the license file in a database?
Posted by Dan H, Last modified by Tanner O on 16 August 2018 12:30 PM
As the license files are XML text, they can be stored in a database as text data.

Once you retrieve the license from the database to a string you may do the following:

For Protection PLUS 5 SDK Native Edition:

  1. Call SK_XmlDocumentCreateFromString to convert the string into an XML document.
  2. Call SK_PLUS_LicenseLoad to load/decrypt the XML Document data in memory.
  3. Make any further calls needed.

To store the license file in the database, you can convert it to a string with the SK_PLUS_LicenseGetDocumentString function then store the string in the database.

For Protection PLUS 5 SDK .NET Edition:

  1. Call the License.Load method to load/decrypt the string license data in memory.
  2. Make any further calls needed.

Additional notes:

  • The strings the library uses are UTF-8, so be sure to handle encoding appropriately when retrieving or storing with a database, otherwise there may be issues decrypting and/or verifying the license files.
  • It is recommended to use a read-only license as it's not practical to use aliases with this kind of environment.
  • Although the blog post How to Protect a Web Application with Licensing Controls is about web applications, much of it still applies to licensing services that run on servers in general, and it may be helpful to read.