mirror of
				https://github.com/jakeswenson/BitBetter.git
				synced 2025-10-31 21:03:25 +00:00 
			
		
		
		
	Refactor and fixes
This commit is contained in:
		
							parent
							
								
									52fabd9a95
								
							
						
					
					
						commit
						93cae61d66
					
				|  | @ -10,30 +10,33 @@ namespace licenseGen; | ||||||
| 
 | 
 | ||||||
| internal class Program | internal class Program | ||||||
| { | { | ||||||
|  |     private static readonly CommandLineApplication App = new(); | ||||||
|  |     private static readonly CommandOption Cert = App.Option("--cert", "cert file", CommandOptionType.SingleValue); | ||||||
|  |     private static readonly CommandOption CoreDll = App.Option("--core", "path to core dll", CommandOptionType.SingleValue); | ||||||
|  | 
 | ||||||
|     private static Int32 Main(String[] args) |     private static Int32 Main(String[] args) | ||||||
|     { |     { | ||||||
|         CommandLineApplication app = new(); |         App.HelpOption("-? | -h | --help"); | ||||||
|         CommandOption cert = app.Option("--cert", "cert file", CommandOptionType.SingleValue); |  | ||||||
|         CommandOption coreDll = app.Option("--core", "path to core dll", CommandOptionType.SingleValue); |  | ||||||
| 
 | 
 | ||||||
|         Boolean CertExists() |         if (!File.Exists(Cert.Value())) | ||||||
|         { |         { | ||||||
|             return File.Exists(cert.Value()); |             App.Error.WriteLine($"Can't find certificate at: {Cert.Value()}"); | ||||||
|  |             App.ShowHelp(); | ||||||
|  |             return 1; | ||||||
|  |         } | ||||||
|  |         if (!File.Exists(CoreDll.Value())) | ||||||
|  |         { | ||||||
|  |             App.Error.WriteLine($"Can't find core dll at: {CoreDll.Value()}"); | ||||||
|  |             App.ShowHelp(); | ||||||
|  |             return 1; | ||||||
|  |         } | ||||||
|  |         if (Cert == null || String.IsNullOrWhiteSpace(Cert.Value()) || CoreDll == null || String.IsNullOrWhiteSpace(CoreDll.Value())) | ||||||
|  |         { | ||||||
|  |             App.ShowHelp(); | ||||||
|  |             return 1; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         Boolean CoreExists() |         App.Command("interactive", config => | ||||||
|         { |  | ||||||
|             return File.Exists(coreDll.Value()); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         Boolean VerifyTopOptions() |  | ||||||
|         { |  | ||||||
|             return !String.IsNullOrWhiteSpace(cert.Value()) && |  | ||||||
|                    !String.IsNullOrWhiteSpace(coreDll.Value()) && |  | ||||||
|                    CertExists() && CoreExists(); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         app.Command("interactive", config => |  | ||||||
|         { |         { | ||||||
|             String buff, licenseType = "", name = "", email = "", businessName=""; |             String buff, licenseType = "", name = "", email = "", businessName=""; | ||||||
|             Int16 storage = 0; |             Int16 storage = 0; | ||||||
|  | @ -43,15 +46,6 @@ internal class Program | ||||||
| 
 | 
 | ||||||
|             config.OnExecute(() => |             config.OnExecute(() => | ||||||
|             { |             { | ||||||
|                 if (!VerifyTopOptions()) |  | ||||||
|                 { |  | ||||||
|                     if (!CoreExists()) config.Error.WriteLine($"Can't find core dll at: {coreDll.Value()}"); |  | ||||||
|                     if (!CertExists()) config.Error.WriteLine($"Can't find certificate at: {cert.Value()}"); |  | ||||||
| 
 |  | ||||||
|                     config.ShowHelp(); |  | ||||||
|                     return 1; |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
|                 Console.WriteLine("Interactive license mode..."); |                 Console.WriteLine("Interactive license mode..."); | ||||||
|                  |                  | ||||||
|                 while (licenseType == "") |                 while (licenseType == "") | ||||||
|  | @ -59,51 +53,55 @@ internal class Program | ||||||
|                     Console.WriteLine("What would you like to generate, a [u]ser license or an [o]rg license: "); |                     Console.WriteLine("What would you like to generate, a [u]ser license or an [o]rg license: "); | ||||||
|                     buff = Console.ReadLine(); |                     buff = Console.ReadLine(); | ||||||
| 
 | 
 | ||||||
|                     if(buff == "u") |                     switch (buff) | ||||||
|                     { |                     { | ||||||
|                         licenseType = "user"; |                         case "u": | ||||||
|                         Console.WriteLine("Okay, we will generate a user license."); |  | ||||||
| 
 |  | ||||||
|                         while (!validGuid) |  | ||||||
|                         { |                         { | ||||||
|                             Console.WriteLine("Please provide the user's guid — refer to the Readme for details on how to retrieve this. [GUID]: "); |                             licenseType = "user"; | ||||||
|                             buff = Console.ReadLine(); |                             Console.WriteLine("Okay, we will generate a user license."); | ||||||
| 
 | 
 | ||||||
|                             if (Guid.TryParse(buff, out guid))validGuid = true; |                             while (!validGuid) | ||||||
|                             else Console.WriteLine("The user-guid provided does not appear to be valid!"); |  | ||||||
|                         } |  | ||||||
|                     } |  | ||||||
|                     else if (buff == "o") |  | ||||||
|                     { |  | ||||||
|                         licenseType = "org"; |  | ||||||
|                         Console.WriteLine("Okay, we will generate an organization license."); |  | ||||||
| 
 |  | ||||||
|                         while (!validInstallid) |  | ||||||
|                         { |  | ||||||
|                             Console.WriteLine("Please provide your Bitwarden Install-ID — refer to the Readme for details on how to retrieve this. [Install-ID]: "); |  | ||||||
|                             buff = Console.ReadLine(); |  | ||||||
| 
 |  | ||||||
|                             if (Guid.TryParse(buff, out installid)) validInstallid = true; |  | ||||||
|                             else Console.WriteLine("The install-id provided does not appear to be valid."); |  | ||||||
|                         } |  | ||||||
| 
 |  | ||||||
|                         while (businessName == "") |  | ||||||
|                         { |  | ||||||
|                             Console.WriteLine("Please enter a business name, default is BitBetter. [Business Name]: "); |  | ||||||
|                             buff = Console.ReadLine(); |  | ||||||
|                             if (buff == "") |  | ||||||
|                             { |                             { | ||||||
|                                 businessName = "BitBetter"; |                                 Console.WriteLine("Please provide the user's guid — refer to the Readme for details on how to retrieve this. [GUID]: "); | ||||||
|                             } |                                 buff = Console.ReadLine(); | ||||||
|                             else if (CheckBusinessName(buff)) | 
 | ||||||
|                             { |                                 if (Guid.TryParse(buff, out guid))validGuid = true; | ||||||
|                                 businessName = buff; |                                 else Console.WriteLine("The user-guid provided does not appear to be valid!"); | ||||||
|                             } |                             } | ||||||
|  |                             break; | ||||||
|                         } |                         } | ||||||
|                     } |                         case "o": | ||||||
|                     else |                         { | ||||||
|                     { |                             licenseType = "org"; | ||||||
|                         Console.WriteLine("Unrecognized option \'" + buff + "\'."); |                             Console.WriteLine("Okay, we will generate an organization license."); | ||||||
|  | 
 | ||||||
|  |                             while (!validInstallid) | ||||||
|  |                             { | ||||||
|  |                                 Console.WriteLine("Please provide your Bitwarden Install-ID — refer to the Readme for details on how to retrieve this. [Install-ID]: "); | ||||||
|  |                                 buff = Console.ReadLine(); | ||||||
|  | 
 | ||||||
|  |                                 if (Guid.TryParse(buff, out installid)) validInstallid = true; | ||||||
|  |                                 else Console.WriteLine("The install-id provided does not appear to be valid."); | ||||||
|  |                             } | ||||||
|  | 
 | ||||||
|  |                             while (businessName == "") | ||||||
|  |                             { | ||||||
|  |                                 Console.WriteLine("Please enter a business name, default is BitBetter. [Business Name]: "); | ||||||
|  |                                 buff = Console.ReadLine(); | ||||||
|  |                                 if (buff == "") | ||||||
|  |                                 { | ||||||
|  |                                     businessName = "BitBetter"; | ||||||
|  |                                 } | ||||||
|  |                                 else if (CheckBusinessName(buff)) | ||||||
|  |                                 { | ||||||
|  |                                     businessName = buff; | ||||||
|  |                                 } | ||||||
|  |                             } | ||||||
|  |                             break; | ||||||
|  |                         } | ||||||
|  |                         default: | ||||||
|  |                             Console.WriteLine("Unrecognized option \'" + buff + "\'."); | ||||||
|  |                             break; | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|  | @ -111,7 +109,7 @@ internal class Program | ||||||
|                 { |                 { | ||||||
|                     Console.WriteLine("Please provide the username this license will be registered to. [username]: "); |                     Console.WriteLine("Please provide the username this license will be registered to. [username]: "); | ||||||
|                     buff = Console.ReadLine(); |                     buff = Console.ReadLine(); | ||||||
|                     if ( CheckUsername(buff) )   name = buff; |                     if (CheckUsername(buff))   name = buff; | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 while (email == "") |                 while (email == "") | ||||||
|  | @ -141,39 +139,46 @@ internal class Program | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 if (licenseType == "user") |                 switch (licenseType) | ||||||
|                 { |                 { | ||||||
|                     Console.WriteLine("Confirm creation of \"user\" license for username: \"" + name + "\", email: \"" + email + "\", Storage: \"" + storage + " GB\", User-GUID: \"" + guid + "\"? Y/n"); |                     case "user": | ||||||
|                     buff = Console.ReadLine(); |  | ||||||
|                     if ( buff is "" or "y" or "Y" ) |  | ||||||
|                     { |                     { | ||||||
|                         GenerateUserLicense(new X509Certificate2(cert.Value(), "test"), coreDll.Value(), name, email, storage, guid, null); |                         Console.WriteLine("Confirm creation of \"user\" license for username: \"" + name + "\", email: \"" + email + "\", Storage: \"" + storage + " GB\", User-GUID: \"" + guid + "\"? Y/n"); | ||||||
|  |                         buff = Console.ReadLine(); | ||||||
|  |                         if (buff is "" or "y" or "Y") | ||||||
|  |                         { | ||||||
|  |                             GenerateUserLicense(new X509Certificate2(Cert.Value(), "test"), CoreDll.Value(), name, email, storage, guid, null); | ||||||
|  |                         } | ||||||
|  |                         else | ||||||
|  |                         { | ||||||
|  |                             Console.WriteLine("Exiting..."); | ||||||
|  |                             return 0; | ||||||
|  |                         } | ||||||
|  | 
 | ||||||
|  |                         break; | ||||||
|                     } |                     } | ||||||
|                     else |                     case "org": | ||||||
|                     { |                     { | ||||||
|                         Console.WriteLine("Exiting..."); |                         Console.WriteLine("Confirm creation of \"organization\" license for business name: \"" + businessName + "\", username: \"" + name + "\", email: \"" + email + "\", Storage: \"" + storage + " GB\", Install-ID: \"" + installid + "\"? Y/n"); | ||||||
|                         return 0; |                         buff = Console.ReadLine(); | ||||||
|                     } |                         if (buff is "" or "y" or "Y") | ||||||
|                 } |                         { | ||||||
|                 else if (licenseType == "org") |                             GenerateOrgLicense(new X509Certificate2(Cert.Value(), "test"), CoreDll.Value(), name, email, storage, installid, businessName, null); | ||||||
|                 { |                         } | ||||||
|                     Console.WriteLine("Confirm creation of \"organization\" license for business name: \"" + businessName + "\", username: \"" + name + "\", email: \"" + email + "\", Storage: \"" + storage + " GB\", Install-ID: \"" + installid + "\"? Y/n"); |                         else | ||||||
|                     buff = Console.ReadLine(); |                         { | ||||||
|                     if ( buff is "" or "y" or "Y" ) |                             Console.WriteLine("Exiting..."); | ||||||
|                     { |                             return 0; | ||||||
|                         GenerateOrgLicense(new X509Certificate2(cert.Value(), "test"), coreDll.Value(), name, email, storage, installid, businessName, null); |                         } | ||||||
|                     } | 
 | ||||||
|                     else |                         break; | ||||||
|                     { |  | ||||||
|                         Console.WriteLine("Exiting..."); |  | ||||||
|                         return 0; |  | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 return 0; |                 return 0; | ||||||
|             }); |             }); | ||||||
|         }); |         }); | ||||||
|         app.Command("user", config => |         App.Command("user", config => | ||||||
|         { |         { | ||||||
|             CommandArgument name = config.Argument("Name", "your name"); |             CommandArgument name = config.Argument("Name", "your name"); | ||||||
|             CommandArgument email = config.Argument("Email", "your email"); |             CommandArgument email = config.Argument("Email", "your email"); | ||||||
|  | @ -183,15 +188,6 @@ internal class Program | ||||||
| 
 | 
 | ||||||
|             config.OnExecute(() => |             config.OnExecute(() => | ||||||
|             { |             { | ||||||
|                 if (!VerifyTopOptions()) |  | ||||||
|                 { |  | ||||||
|                     if (!CoreExists()) config.Error.WriteLine($"Can't find core dll at: {coreDll.Value()}"); |  | ||||||
|                     if (!CertExists()) config.Error.WriteLine($"Can't find certificate at: {cert.Value()}"); |  | ||||||
| 
 |  | ||||||
|                     config.ShowHelp(); |  | ||||||
|                     return 1; |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
|                 if (String.IsNullOrWhiteSpace(name.Value) || String.IsNullOrWhiteSpace(email.Value)) |                 if (String.IsNullOrWhiteSpace(name.Value) || String.IsNullOrWhiteSpace(email.Value)) | ||||||
|                 { |                 { | ||||||
|                     config.Error.WriteLine($"Some arguments are missing: Name='{name.Value}' Email='{email.Value}'"); |                     config.Error.WriteLine($"Some arguments are missing: Name='{name.Value}' Email='{email.Value}'"); | ||||||
|  | @ -219,12 +215,12 @@ internal class Program | ||||||
|                     storageShort = (Int16) parsedStorage; |                     storageShort = (Int16) parsedStorage; | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 GenerateUserLicense(new X509Certificate2(cert.Value(), "test"), coreDll.Value(), name.Value, email.Value, storageShort, userId, key.Value); |                 GenerateUserLicense(new X509Certificate2(Cert.Value()!, "test"), CoreDll.Value(), name.Value, email.Value, storageShort, userId, key.Value); | ||||||
| 
 | 
 | ||||||
|                 return 0; |                 return 0; | ||||||
|             }); |             }); | ||||||
|         }); |         }); | ||||||
|         app.Command("org", config => |         App.Command("org", config => | ||||||
|         { |         { | ||||||
|             CommandArgument name = config.Argument("Name", "your name"); |             CommandArgument name = config.Argument("Name", "your name"); | ||||||
|             CommandArgument email = config.Argument("Email", "your email"); |             CommandArgument email = config.Argument("Email", "your email"); | ||||||
|  | @ -235,18 +231,7 @@ internal class Program | ||||||
|              |              | ||||||
|             config.OnExecute(() => |             config.OnExecute(() => | ||||||
|             { |             { | ||||||
|                 if (!VerifyTopOptions()) |                 if (String.IsNullOrWhiteSpace(name.Value) || String.IsNullOrWhiteSpace(email.Value) || String.IsNullOrWhiteSpace(installId.Value)) | ||||||
|                 { |  | ||||||
|                     if (!CoreExists()) config.Error.WriteLine($"Can't find core dll at: {coreDll.Value()}"); |  | ||||||
|                     if (!CertExists()) config.Error.WriteLine($"Can't find certificate at: {cert.Value()}"); |  | ||||||
| 
 |  | ||||||
|                     config.ShowHelp(); |  | ||||||
|                     return 1; |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
|                 if (String.IsNullOrWhiteSpace(name.Value) || |  | ||||||
|                     String.IsNullOrWhiteSpace(email.Value) || |  | ||||||
|                     String.IsNullOrWhiteSpace(installId.Value)) |  | ||||||
|                 { |                 { | ||||||
|                     config.Error.WriteLine($"Some arguments are missing: Name='{name.Value}' Email='{email.Value}' InstallId='{installId.Value}'"); |                     config.Error.WriteLine($"Some arguments are missing: Name='{name.Value}' Email='{email.Value}' InstallId='{installId.Value}'"); | ||||||
|                     config.ShowHelp(true); |                     config.ShowHelp(true); | ||||||
|  | @ -271,26 +256,24 @@ internal class Program | ||||||
|                         config.ShowHelp(true); |                         config.ShowHelp(true); | ||||||
|                         return 1; |                         return 1; | ||||||
|                     } |                     } | ||||||
|                     storageShort = (Int16) parsedStorage; |                     storageShort = (Int16)parsedStorage; | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 GenerateOrgLicense(new X509Certificate2(cert.Value(), "test"), coreDll.Value(), name.Value, email.Value, storageShort, installationId, businessName.Value, key.Value); |                 GenerateOrgLicense(new X509Certificate2(Cert.Value()!, "test"), CoreDll.Value(), name.Value, email.Value, storageShort, installationId, businessName.Value, key.Value); | ||||||
| 
 | 
 | ||||||
|                 return 0; |                 return 0; | ||||||
|             }); |             }); | ||||||
|         }); |         }); | ||||||
| 
 | 
 | ||||||
|         app.OnExecute(() => |         App.OnExecute(() => | ||||||
|         { |         { | ||||||
|             app.ShowHelp(); |             App.ShowHelp(); | ||||||
|             return 10; |             return 10; | ||||||
|         }); |         }); | ||||||
| 
 | 
 | ||||||
|         app.HelpOption("-? | -h | --help"); |  | ||||||
| 
 |  | ||||||
|         try |         try | ||||||
|         { |         { | ||||||
|             return app.Execute(args); |             return App.Execute(args); | ||||||
|         } |         } | ||||||
|         catch (Exception e) |         catch (Exception e) | ||||||
|         { |         { | ||||||
|  | @ -351,8 +334,33 @@ internal class Program | ||||||
|         Type type = core.GetType("Bit.Core.Billing.Models.Business.UserLicense"); |         Type type = core.GetType("Bit.Core.Billing.Models.Business.UserLicense"); | ||||||
|         Type licenseTypeEnum = core.GetType("Bit.Core.Enums.LicenseType"); |         Type licenseTypeEnum = core.GetType("Bit.Core.Enums.LicenseType"); | ||||||
| 
 | 
 | ||||||
|  |         if (type == null) | ||||||
|  |         { | ||||||
|  |             Console.WriteLine("Could not find type!"); | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  |         if (licenseTypeEnum == null) | ||||||
|  |         { | ||||||
|  |             Console.WriteLine("Could not find license licenseTypeEnum!"); | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         Object license = Activator.CreateInstance(type); |         Object license = Activator.CreateInstance(type); | ||||||
| 
 | 
 | ||||||
|  |         MethodInfo computeHash = type.GetMethod("ComputeHash"); | ||||||
|  |         if (computeHash == null) | ||||||
|  |         { | ||||||
|  |             Console.WriteLine("Could not find ComputeHash!"); | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         MethodInfo sign = type.GetMethod("Sign"); | ||||||
|  |         if (sign == null) | ||||||
|  |         { | ||||||
|  |             Console.WriteLine("Could not find sign!"); | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         Set("LicenseKey", String.IsNullOrWhiteSpace(key) ? Guid.NewGuid().ToString("n") : key); |         Set("LicenseKey", String.IsNullOrWhiteSpace(key) ? Guid.NewGuid().ToString("n") : key); | ||||||
|         Set("Id", userId); |         Set("Id", userId); | ||||||
|         Set("Name", userName); |         Set("Name", userName); | ||||||
|  | @ -365,8 +373,8 @@ internal class Program | ||||||
|         Set("Expires", DateTime.UtcNow.AddYears(100)); |         Set("Expires", DateTime.UtcNow.AddYears(100)); | ||||||
|         Set("Trial", false); |         Set("Trial", false); | ||||||
|         Set("LicenseType", Enum.Parse(licenseTypeEnum, "User")); |         Set("LicenseType", Enum.Parse(licenseTypeEnum, "User")); | ||||||
|         Set("Hash", Convert.ToBase64String((Byte[])type.GetMethod("ComputeHash").Invoke(license, []))); |         Set("Hash", Convert.ToBase64String(((Byte[])computeHash.Invoke(license, []))!)); | ||||||
|         Set("Signature", Convert.ToBase64String((Byte[])type.GetMethod("Sign").Invoke(license, [cert]))); |         Set("Signature", Convert.ToBase64String((Byte[])sign.Invoke(license, [cert])!)); | ||||||
| 
 | 
 | ||||||
|         Console.WriteLine(JsonConvert.SerializeObject(license, Formatting.Indented)); |         Console.WriteLine(JsonConvert.SerializeObject(license, Formatting.Indented)); | ||||||
|         return; |         return; | ||||||
|  | @ -381,12 +389,42 @@ internal class Program | ||||||
|     { |     { | ||||||
|         Assembly core = AssemblyLoadContext.Default.LoadFromAssemblyPath(corePath); |         Assembly core = AssemblyLoadContext.Default.LoadFromAssemblyPath(corePath); | ||||||
| 
 | 
 | ||||||
|         Type type = core.GetType("Bit.Core.Models.Billing.Business.OrganizationLicense"); |         Type type = core.GetType("Bit.Core.Billing.Organizations.Models"); | ||||||
|         Type licenseTypeEnum = core.GetType("Bit.Core.Enums.LicenseType"); |         Type licenseTypeEnum = core.GetType("Bit.Core.Enums.LicenseType"); | ||||||
|         Type planTypeEnum = core.GetType("Bit.Core.Billing.Enums.PlanType"); |         Type planTypeEnum = core.GetType("Bit.Core.Billing.Enums.PlanType"); | ||||||
| 
 | 
 | ||||||
|  |         if (type == null) | ||||||
|  |         { | ||||||
|  |             Console.WriteLine("Could not find type!"); | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  |         if (licenseTypeEnum == null) | ||||||
|  |         { | ||||||
|  |             Console.WriteLine("Could not find licenseTypeEnum!"); | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  |         if (planTypeEnum == null) | ||||||
|  |         { | ||||||
|  |             Console.WriteLine("Could not find planTypeEnum!"); | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         Object license = Activator.CreateInstance(type); |         Object license = Activator.CreateInstance(type); | ||||||
| 
 | 
 | ||||||
|  |         MethodInfo computeHash = type.GetMethod("ComputeHash"); | ||||||
|  |         if (computeHash == null) | ||||||
|  |         { | ||||||
|  |             Console.WriteLine("Could not find ComputeHash!"); | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         MethodInfo sign = type.GetMethod("Sign"); | ||||||
|  |         if (sign == null) | ||||||
|  |         { | ||||||
|  |             Console.WriteLine("Could not find sign!"); | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         Set("LicenseKey", String.IsNullOrWhiteSpace(key) ? Guid.NewGuid().ToString("n") : key); |         Set("LicenseKey", String.IsNullOrWhiteSpace(key) ? Guid.NewGuid().ToString("n") : key); | ||||||
|         Set("InstallationId", instalId); |         Set("InstallationId", instalId); | ||||||
|         Set("Id", Guid.NewGuid()); |         Set("Id", Guid.NewGuid()); | ||||||
|  | @ -431,8 +469,8 @@ internal class Program | ||||||
| 		Set("UseRiskInsights", true); | 		Set("UseRiskInsights", true); | ||||||
|         Set("UseOrganizationDomains", true); |         Set("UseOrganizationDomains", true); | ||||||
|         Set("UseAdminSponsoredFamilies", true); |         Set("UseAdminSponsoredFamilies", true); | ||||||
|         Set("Hash", Convert.ToBase64String((Byte[])type.GetMethod("ComputeHash").Invoke(license, []))); |         Set("Hash", Convert.ToBase64String((Byte[])computeHash.Invoke(license, [])!)); | ||||||
|         Set("Signature", Convert.ToBase64String((Byte[])type.GetMethod("Sign").Invoke(license, [cert]))); |         Set("Signature", Convert.ToBase64String((Byte[])sign.Invoke(license, [cert])!)); | ||||||
| 
 | 
 | ||||||
|         Console.WriteLine(JsonConvert.SerializeObject(license, Formatting.Indented)); |         Console.WriteLine(JsonConvert.SerializeObject(license, Formatting.Indented)); | ||||||
|         return; |         return; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user