If you’ve made it Part 3 then you either find this subject really interesting or else you have difficulty sleeping at night :-) This final part of my article on Software Licensing discusses some of the ‘nitty gritty’ and gets down and dirty with some real code samples. All code samples are taken from oneSql.
The value of Part 3 of this article will be mainly to developers using the Xojo Programming Language for Cross Platform Software Development, although developers in any language can benefit and in fact anybody with an interest in going ‘behind the scenes’ of software development.
One thing very noticeable when preparing this article is just how much ‘behind the scenes’ work is necessary sometimes to give the customer a simple, slick experience. Simple is hard ! The way this article is structured with a Customer Experience section followed straight after by a Behind the Scenes section, makes this very clear.
CUSTOMER EXPERIENCE 
When the customer decides that your product is for her, as far is as she is concerned the following two events take place:
- The customer clicks the Buy Now button and is taken to the Paypal login page.
- The customer decides whether to pay via Card or Paypal, then fills in the form and submits the document.
BEHIND THE SCENES 
chol.technology receive the Order Confirmation via Paypal. The chol.technology LicenseBoss Software automates the following sequence of events:
- Product and Edition Information fetched from the LicenseBoss Database
- The Encryption Key for the Product Editon is retrieved. Abbreviated as Key1
- LicenseBoss parses and Inputs: User Name, Email Address, TimeStamp and Transaction ID
- LicenseBoss combines the input into a string with appropriate delimiters and identity markers
- We now have a ClearTextLicenseString
- The ClearTextLicenseString is then encrypted using Key1. We now have the EncryptedLicenseString
- The ClearTextLicenseString and the EncryptedLicenseString are then concatenated
- We now have the FirstPassLicenseFileString
- FirstPassLicenseFileString is then encrypted using the License File Encryption Key = Key 2
- We now have the EncryptedLicenseFileContentsString
- An email is then generated from a Template and the EncryptedLicenseFileContentsString is appended
- The email is sent to the customer
CUSTOMER EXPERIENCE 
The customer receives an email which looks similar to this:
The instructions are Clearly Documented for the customer in an email as a Four Step Process. After Step 4 the product is fully licensed, and the window below is displayed briefly before closing automatically:
BEHIND THE SCENES 
The Software License window, accepts the email pasted into it and immediately strips the unnecessary information and displays the encrypted license. The actual encrypted license is contained between the <CHOLTECH> and </CHOLTECH> tags, therefore the only part of the pasted email that is displayed and then processed is the part taken from between those two tags.
When the Save button is pressed the encrypted license is created as a text file and stored in the SupportFiles folder within the oneSql folder. The newly created license file is called oneSqlLicense.lic
At this point the License File Decode method is called with the license file contents as a string parameter. Multiple flags are altered and adjusted within the program to indicate that the product is now licensed. Further details on that wouldn’t be prudent for me to discuss publicly
The actual license file decode method is straightforward. All the Encryption and Decryption routines are pre-build, based on my R10Cipher File and Text Encryption product, (shameless plug – developer licenses are available for the Encryption modules, contact me for details) and imported into my products as a module whenever I start to develop a new program.
Obviously the DecodeLicenseFile method basically reverses the work done by the EncodeLicenseFile method in the LicenseBoss program as described in step by step detail earlier.
I know some of you out there are Xojo Developers, so here’s a commented example of the code. You can see how straightforward it actually is:
NOTE: Licensing in this fashion has an additional benefit. It caters for Zero Effort Configuration.
In a corporate environment if you were rolling out oneSql to dozens of computers, you could have a centrally situated Corporate or Site License which could be copied to each persons computer using a script. Very Fast, Very Simple and Damned Convenient Essentially zero interaction required from the user. That’s got to be a good thing