The license is based on the Computer Id, License Id (e-mail address) and an expiration date.
The method that generates the license looks like
Code: Select all
public static string GetLicenseKey(string computerId, string licenseId, DateTime expirationDate)
{
var data = new StringBuilder();
var date = expirationDate.ToString("MM/dd/yyyy");
if (computerId != null) data.Append($"COMP_ID={computerId}ID={licenseId}EXP={date}");
var sPrivateKeyPEM = File.ReadAllText(@"c:\temp\key.pem");
var rsaProvider = GetRSA(sPrivateKeyPEM);
// compute signature
var dataToSign = Encoding.Unicode.GetBytes(data.ToString());
var signature = rsaProvider.SignData(dataToSign, new SHA1CryptoServiceProvider());
// Step 4 - Respond with the license elements
// if your license has a Maintainance Plan element (or any other elements) add them in alphabetical order
var license = "ID=" + licenseId + ";EXP=" + date + ";SIGN=" + Convert.ToBase64String(signature);
return license;
}
Kind regards,
Marco