From abf31008fe42bdbd33dcc8b61c739baf9affd19c Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 17 Aug 2022 00:34:29 +0000 Subject: [PATCH] --- util/RavenKeyFactory.cs | 108 ++++++++++------------------------------ 1 file changed, 26 insertions(+), 82 deletions(-) diff --git a/util/RavenKeyFactory.cs b/util/RavenKeyFactory.cs index 6f8ce02..25a86b8 100644 --- a/util/RavenKeyFactory.cs +++ b/util/RavenKeyFactory.cs @@ -6,6 +6,31 @@ using Org.BouncyCastle.Security; using Org.BouncyCastle.Crypto; using Org.BouncyCastle.OpenSsl; +/* +Sample key: +[KEY +{ + "Key": { + "LicenseFormat": "8", + "Id": "1660594773", + "RegisteredTo": "AAA TEST DEVELOPMENT", + "DBID": "1q3Q8MedzUQ/VQVWjQiLs3o/7nSbNFUpF5KzkM/Ny0M=", + "Perpetual": true, + "LicenseExpiration": "5555-01-01T00:00:00", + "MaintenanceExpiration": "2023-08-15T00:00:00", + "Features": [ + { + "Name": "ServiceTechs", + "Count": 100 + } + ] + } +} +KEY] +[SIGNATURE +VaVGBaXjnh1A7etqYp9bu5XkGaLxD2AplT+DERaIL8gHqSEj+1s3seEZpuRBJAvof5j++Si3ZCuesYL2M6IQUwmimYMwbQPH07MixOYxgc4kKMO53AwTmtBxwEzUYdhMn5i3g/2xOpJoXTsyqOJ0v1ZidFswQs8vVtxBO8uanlMKzFpXZE8K0cI8ZII9nRdBoUERO+JoEE16l/UAgi6O7KT8l1r225RodFhAThrdAT5ntIJ0JaTHPaMgnYb25VGS9LYQUWU7nkA+IsfddjxZW70a8IHXvQ1B5oV6srFVdkS4wY0dgbT+k7VJBDhMmltRDdOUH + +*/ namespace rockfishCore.Util @@ -25,10 +50,7 @@ namespace rockfishCore.Util //Scheduleable users private const string SERVICE_TECHS_FEATURE_NAME = "ServiceTechs"; //Add-on's / integrations - //thse are now included so not relevant here but keeping for renaming for future subscription add-on's - // private const string OLI_FEATURE_NAME = "OLI"; - // private const string QBI_FEATURE_NAME = "QBI"; - // private const string QBOI_FEATURE_NAME = "QBOI"; + //This feature name means it's a trial key private const string TRIAL_FEATURE_NAME = "TrialMode"; @@ -65,19 +87,7 @@ namespace rockfishCore.Util public override string ToString() { - /*LICENSE DETAILS -Registered to: Montacargas y Equipos Colombia -Fetch address: facordoba@jycexports.com -Fetch code: ZgVySojpHg -Scheduleable resources: Up to 15 -Support and updates until: Thursday, August 13, 2020 - -Plugins: - WBI - Web browser interface support and updates until: Tuesday, June 15, 2021 - ExportToXls support and updates until: Tuesday, June 15, 2021 - ImportExportCSVDuplicate support and updates until: Friday, July 17, 2020 - RI - Responsive Interface support and updates until: Tuesday, June 15, 2021 */ System.Text.StringBuilder sb = new StringBuilder(); sb.AppendLine("LICENSE DETAILS"); sb.AppendLine($"Registered to: {RegisteredTo}"); @@ -94,16 +104,6 @@ Plugins: continue; } - // if (f.Feature == QBI_FEATURE_NAME) - // { - // sb.AppendLine("QuickBooks desktop integration option"); - // continue; - // } - // if (f.Feature == QBOI_FEATURE_NAME) - // { - // sb.AppendLine("QuickBooks online integration option"); - // continue; - // } if (f.Feature == SERVICE_TECHS_FEATURE_NAME) { sb.AppendLine($"Scheduleable resources: {f.Count}"); @@ -223,42 +223,7 @@ Plugins: } #endregion - #region sample v8 key - // private static string SAMPLE_KEY = @"[KEY - // { - // ""Key"": { - // ""LicenseFormat"": ""8"", - // ""Id"": ""34-1516288681"", <----Customer id followed by key serial id - // ""RegisteredTo"": ""Super TestCo"", - // ""DBID"": ""df558559-7f8a-4c7b-955c-959ebcdf71f3"", - // ""LicenseExpiration"": ""2019-01-18T07:18:01.2329138-08:00"", <--- UTC,special 1/1/5555 DateTime if perpetual license, applies to all features 1/1/5555 indicates not expiring - // ""MaintenanceExpiration"": ""2019-01-18T07:18:01.2329138-08:00"", <-- UTC, DateTime support and updates subscription runs out, applies to all features - // ""Features"": { <-- deprecate, collection doesn't need to be inside a property? - // ""Feature"": [ - // { - // ""Name"": ""ServiceTechs"", - // ""Count"":""10"", - // }, - // { - // ""Name"": ""Accounting"" - // }, - // { - // ""Name"": ""TrialMode""<---means is a trial key - // }, - // { - // ""Name"": ""Subscription"" <----Means it's an SAAS/Rental key - // } - // ] - // } - // } - // } - // KEY] - // [SIGNATURE - // HEcY3JCVwK9HFXEFnldUEPXP4Q7xoZfMZfOfx1cYmfVF3MVWePyZ9dqVZcY7pk3RmR1BbhQdhpljsYLl+ZLTRhNa54M0EFa/bQnBnbwYZ70EQl8fz8WOczYTEBo7Sm5EyC6gSHtYZu7yRwBvhQzpeMGth5uWnlfPb0dMm0DQM7PaqhdWWW9GCSOdZmFcxkFQ8ERLDZhVMbd8PJKyLvZ+sGMrmYTAIoL0tqa7nrxYkM71uJRTAmQ0gEl4bJdxiV825U1J+buNQuTZdacZKEPSjQQkYou10jRbReUmP2vDpvu+nA1xdJe4b5LlyQL+jiIXH17lf93xlCUb0UkDpu8iNQ== - // SIGNATURE]\"; - - #endregion @@ -269,27 +234,15 @@ Plugins: //Build a sample test key, sign it and return it AyaNovaLicenseKey k = new AyaNovaLicenseKey(); k.LicenseFormat = "8"; - - // 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; k.Perpetual = Perpetual; - //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 = QBI_FEATURE_NAME, Count = 0 }); k.Features.Add(new LicenseFeature() { Feature = SERVICE_TECHS_FEATURE_NAME, Count = 100 }); - return GenerateRavenKey(k); } @@ -482,12 +435,3 @@ oArP0E2Vbow3JMxq/oeXmHbrLMLQfYyXwFmciLFigOtkd45bfHdrbA== } //eons } - -// #region RAVEN test code for development - -// //Trial key magic number for development and testing, all other guids will be fully licensed -// private static Guid TEST_TRIAL_KEY_DBID = new Guid("{A6D18A8A-5613-4979-99DA-80D07641A2FE}"); - - - -// #endregion \ No newline at end of file