This commit is contained in:
@@ -5,8 +5,6 @@ using System.IO;
|
||||
using Org.BouncyCastle.Security;
|
||||
using Org.BouncyCastle.Crypto;
|
||||
using Org.BouncyCastle.OpenSsl;
|
||||
using rockfishCore.Models;
|
||||
using rockfishCore.Util;
|
||||
|
||||
|
||||
|
||||
@@ -30,6 +28,8 @@ namespace rockfishCore.Util
|
||||
//This feature name means it's a trial key
|
||||
private const string TRIAL_FEATURE_NAME = "TrialMode";
|
||||
|
||||
public const int TRIAL_PERIOD_DAYS = 45;
|
||||
|
||||
//This feature name means it's a SAAS or rental mode key for month to month hosted service
|
||||
private const string RENTAL_FEATURE_NAME = "ServiceMode";
|
||||
|
||||
@@ -202,6 +202,38 @@ namespace rockfishCore.Util
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
public static string GetRavenTrialKey(Guid dbid, string CompanyName)
|
||||
{
|
||||
|
||||
//Build a sample test key, sign it and return it
|
||||
AyaNovaLicenseKey k = new AyaNovaLicenseKey();
|
||||
k.LicenseFormat = "2018";
|
||||
|
||||
var vv = Math.Truncate((DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds);
|
||||
string sId = vv.ToString();
|
||||
if (sId.Contains(","))
|
||||
sId = sId.Split('.')[0];
|
||||
k.Id = $"00-{sId}";
|
||||
k.RegisteredTo = CompanyName;
|
||||
k.DbId = dbid;
|
||||
|
||||
//trial period time limit
|
||||
k.MaintenanceExpiration = k.LicenseExpiration = DateTime.UtcNow.AddDays(TRIAL_PERIOD_DAYS);
|
||||
|
||||
//flag as trial key not regular key
|
||||
k.Features.Add(new LicenseFeature() { Feature = TRIAL_FEATURE_NAME, Count = 0 });
|
||||
|
||||
//add every possible feature
|
||||
k.Features.Add(new LicenseFeature() { Feature = ACCOUNTING_FEATURE_NAME, Count = 0 });
|
||||
k.Features.Add(new LicenseFeature() { Feature = SERVICE_TECHS_FEATURE_NAME, Count = 1000 });
|
||||
|
||||
return genKey(k);
|
||||
}
|
||||
|
||||
|
||||
#region RAVEN test code for development
|
||||
|
||||
//Trial key magic number for development and testing, all other guids will be fully licensed
|
||||
|
||||
Reference in New Issue
Block a user