├── LicenseEngine ├── KeyGenerateUI │ ├── icon.ico │ ├── img │ │ ├── icon.ico │ │ └── icon.png │ ├── App.config │ ├── App.xaml.cs │ ├── Properties │ │ ├── Settings.settings │ │ ├── Settings.Designer.cs │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ └── Resources.resx │ ├── packages.config │ ├── App.xaml │ ├── MainWindow.xaml.cs │ ├── MainWindow.xaml │ └── KeyGenerateUI.csproj ├── KeyVerify │ ├── KeyResult.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── KeyVerify.csproj │ ├── ActivationKeyFileCheck.cs │ ├── ActivationKeyDecryption.cs │ └── KeyCheck.cs ├── KeyTest │ ├── packages.config │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── KeyTest.csproj │ └── KeyTests.cs ├── KeyGenerate │ ├── KeyByteSetComparer.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── KeyGenerate.csproj │ └── KeyGenerator.cs ├── KeyCommon │ ├── KeyByteSet.cs │ ├── Exceptions.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── KeyCommon.csproj └── LicenseEngine.sln ├── README.md ├── LICENSE.md ├── .gitattributes └── .gitignore /LicenseEngine/KeyGenerateUI/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcf-dev/LicenseEngine/HEAD/LicenseEngine/KeyGenerateUI/icon.ico -------------------------------------------------------------------------------- /LicenseEngine/KeyGenerateUI/img/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcf-dev/LicenseEngine/HEAD/LicenseEngine/KeyGenerateUI/img/icon.ico -------------------------------------------------------------------------------- /LicenseEngine/KeyGenerateUI/img/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jcf-dev/LicenseEngine/HEAD/LicenseEngine/KeyGenerateUI/img/icon.png -------------------------------------------------------------------------------- /LicenseEngine/KeyGenerateUI/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /LicenseEngine/KeyVerify/KeyResult.cs: -------------------------------------------------------------------------------- 1 | namespace KeyVerify 2 | { 3 | public enum LicenseKeyResult 4 | { 5 | KeyGood = 0, 6 | KeyInvalid = 1, 7 | KeyBlackListed = 2, 8 | KeyPhoney = 3 9 | } 10 | } -------------------------------------------------------------------------------- /LicenseEngine/KeyGenerateUI/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace KeyGenerateUI 4 | { 5 | /// 6 | /// Interaction logic for App.xaml 7 | /// 8 | public partial class App : Application 9 | { 10 | } 11 | } -------------------------------------------------------------------------------- /LicenseEngine/KeyGenerateUI/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LicenseEngine/KeyTest/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LicenseEngine/KeyGenerateUI/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /LicenseEngine/KeyGenerate/KeyByteSetComparer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using KeyCommon; 3 | 4 | namespace KeyGenerate 5 | { 6 | public class KeyByteSetComparer : IComparer 7 | { 8 | public int Compare(object x, object y) 9 | { 10 | var kbs1 = (KeyByteSet) x; 11 | var kbs2 = (KeyByteSet) y; 12 | 13 | if (kbs1.KeyByteNo > kbs2.KeyByteNo) return 1; 14 | 15 | if (kbs1.KeyByteNo < kbs2.KeyByteNo) return -1; 16 | 17 | return 0; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /LicenseEngine/KeyCommon/KeyByteSet.cs: -------------------------------------------------------------------------------- 1 | namespace KeyCommon 2 | { 3 | public class KeyByteSet 4 | { 5 | public KeyByteSet(int keyByteNo, byte keyByteA, byte keyByteB, byte keyByteC) 6 | { 7 | KeyByteNo = keyByteNo; 8 | KeyByteA = keyByteA; 9 | KeyByteB = keyByteB; 10 | KeyByteC = keyByteC; 11 | } 12 | 13 | public int KeyByteNo { get; } 14 | public byte KeyByteA { get; } 15 | public byte KeyByteB { get; } 16 | public byte KeyByteC { get; } 17 | } 18 | } -------------------------------------------------------------------------------- /LicenseEngine/KeyTest/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | [assembly: AssemblyTitle("KeyTest")] 5 | [assembly: AssemblyDescription("")] 6 | [assembly: AssemblyConfiguration("")] 7 | [assembly: AssemblyCompany("")] 8 | [assembly: AssemblyProduct("KeyTest")] 9 | [assembly: AssemblyCopyright("Copyright © 2020")] 10 | [assembly: AssemblyTrademark("")] 11 | [assembly: AssemblyCulture("")] 12 | 13 | [assembly: ComVisible(false)] 14 | 15 | [assembly: Guid("1d7bdb7b-c752-4581-a4d7-5e53995d620f")] 16 | 17 | // [assembly: AssemblyVersion("1.0.*")] 18 | [assembly: AssemblyVersion("1.0.0.0")] 19 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # License Engine UI 2 | 3 | License Engine UI is a simple GUI version of the [AppSoftware's .NET License Generator](https://github.com/appsoftwareltd/dotnet-licence-key-generator) optimized for .NET 4.5 and above. 4 | 5 | ## Usage 6 | Download the [binaries here](https://github.com/joweenflores/LicenseEngine/releases/tag/1.0.0). 7 | 8 | Add **KeyCommon.dll** and **KeyVerify.dll** to your project references or use **KeyGenerateUI** to generate license keys. 9 | 10 | ## Contributing 11 | Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. 12 | 13 | Please make sure to update the tests as appropriate. 14 | 15 | ## Credits 16 | [AppSoftware](https://github.com/appsoftwareltd/dotnet-licence-key-generator) for the original License Generator. 17 | 18 | [MahApps.Metro](https://github.com/MahApps/MahApps.Metro) for the UI Look and Feel. 19 | 20 | ## License 21 | [MIT](https://choosealicense.com/licenses/mit/) 22 | -------------------------------------------------------------------------------- /LicenseEngine/KeyCommon/Exceptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace KeyCommon 4 | { 5 | /// 6 | /// Exception indicating that the activation key file was not found in the correct location. 7 | /// 8 | public class ActivationKeyFileNotPresentException : Exception 9 | { 10 | public ActivationKeyFileNotPresentException(string message) : base(message) 11 | { 12 | } 13 | } 14 | 15 | /// 16 | /// Exception indicating that the trial period for this application has expired. 17 | /// 18 | public class TrialPeriodExpiredException : Exception 19 | { 20 | public TrialPeriodExpiredException(string message) : base(message) 21 | { 22 | } 23 | } 24 | 25 | /// 26 | /// Exception indicating that value in activation key file was invalid. 27 | /// 28 | public class ActivationKeyInvalidException : Exception 29 | { 30 | public ActivationKeyInvalidException(string message) : base(message) 31 | { 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Joween Flores 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LicenseEngine/KeyGenerateUI/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace KeyGenerateUI.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /LicenseEngine/KeyGenerateUI/App.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /LicenseEngine/KeyCommon/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("KeyCommon")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("KeyCommon")] 12 | [assembly: AssemblyCopyright("Copyright © 2020")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("2024f82c-3306-41b5-951c-0b08f7c65590")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /LicenseEngine/KeyVerify/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("KeyVerify")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("KeyVerify")] 12 | [assembly: AssemblyCopyright("Copyright © 2020")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("808a2a81-2113-4eaa-b595-9c2cd3d61595")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /LicenseEngine/KeyGenerate/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("KeyGenerate")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("KeyGenerate")] 12 | [assembly: AssemblyCopyright("Copyright © 2020")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("df29a928-ab54-4752-9ea6-a05cc8fa6f3c")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /LicenseEngine/KeyGenerateUI/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.Windows; 3 | using KeyCommon; 4 | using KeyGenerate; 5 | using MahApps.Metro.Controls; 6 | 7 | namespace KeyGenerateUI 8 | { 9 | /// 10 | /// Interaction logic for MainWindow.xaml 11 | /// 12 | public partial class MainWindow : MetroWindow 13 | { 14 | public MainWindow() 15 | { 16 | InitializeComponent(); 17 | } 18 | 19 | private void BtnGenerate_Click(object sender, RoutedEventArgs e) 20 | { 21 | var prodID = TxtProdID.Text; 22 | TxtLicense.Text = prodID != "" 23 | ? int.TryParse(prodID, out var ID) ? GenerateKey(ID) : "ERROR: Product ID must be an integer." 24 | : "ERROR: Please provide a Product ID Integer."; 25 | } 26 | 27 | private string GenerateKey(int ID) 28 | { 29 | var keyGenerator = new KeyGenerator(); 30 | 31 | var keyBytes = new[] 32 | { 33 | new KeyByteSet(1, 254, 122, 96), 34 | new KeyByteSet(2, 54, 124, 222), 35 | new KeyByteSet(3, 119, 142, 132), 36 | new KeyByteSet(4, 128, 122, 10), 37 | new KeyByteSet(5, 165, 15, 132), 38 | new KeyByteSet(6, 128, 175, 213), 39 | new KeyByteSet(7, 7, 244, 132), 40 | new KeyByteSet(8, 128, 122, 251) 41 | }; 42 | 43 | var key = keyGenerator.MakeKey(ID, keyBytes); 44 | return key; 45 | } 46 | 47 | private void BtnReset_Click(object sender, RoutedEventArgs e) 48 | { 49 | TxtLicense.Text = ""; 50 | TxtProdID.Text = ""; 51 | } 52 | 53 | private void BtnHelp_OnClick(object sender, RoutedEventArgs e) 54 | { 55 | Process.Start("https://github.com/joweenflores/LicenseEngine"); 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /LicenseEngine/KeyGenerateUI/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | using System.Windows; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("KeyGenerateUI")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("KeyGenerateUI")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | //In order to begin building localizable applications, set 23 | //CultureYouAreCodingWith in your .csproj file 24 | //inside a . For example, if you are using US english 25 | //in your source files, set the to en-US. Then uncomment 26 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 27 | //the line below to match the UICulture setting in the project file. 28 | 29 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 30 | 31 | 32 | [assembly: ThemeInfo( 33 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 34 | //(used if a resource is not found in the page, 35 | // or application resource dictionaries) 36 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 37 | //(used if a resource is not found in the page, 38 | // app, or any theme specific resource dictionaries) 39 | )] 40 | 41 | 42 | // Version information for an assembly consists of the following four values: 43 | // 44 | // Major Version 45 | // Minor Version 46 | // Build Number 47 | // Revision 48 | // 49 | // You can specify all the values or you can default the Build and Revision Numbers 50 | // by using the '*' as shown below: 51 | // [assembly: AssemblyVersion("1.0.*")] 52 | [assembly: AssemblyVersion("1.0.0.0")] 53 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /LicenseEngine/KeyCommon/KeyCommon.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {2024F82C-3306-41B5-951C-0B08F7C65590} 8 | Library 9 | Properties 10 | KeyCommon 11 | KeyCommon 12 | v4.5.2 13 | 512 14 | true 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | true 35 | 36 | 37 | bin\Final Release\ 38 | TRACE 39 | true 40 | pdbonly 41 | AnyCPU 42 | 7.3 43 | prompt 44 | MinimumRecommendedRules.ruleset 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /LicenseEngine/KeyGenerateUI/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace KeyGenerateUI.Properties 12 | { 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("KeyGenerateUI.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /LicenseEngine/KeyGenerate/KeyGenerate.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {DF29A928-AB54-4752-9EA6-A05CC8FA6F3C} 8 | Library 9 | Properties 10 | KeyGenerate 11 | KeyGenerate 12 | v4.5.2 13 | 512 14 | true 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | true 33 | 34 | 35 | bin\Final Release\ 36 | TRACE 37 | true 38 | pdbonly 39 | AnyCPU 40 | 7.3 41 | prompt 42 | MinimumRecommendedRules.ruleset 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | {2024f82c-3306-41b5-951c-0b08f7c65590} 62 | KeyCommon 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /LicenseEngine/LicenseEngine.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29728.190 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeyGenerateUI", "KeyGenerateUI\KeyGenerateUI.csproj", "{69A27771-A916-45AB-8C6F-5E015404EFCF}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeyGenerate", "KeyGenerate\KeyGenerate.csproj", "{DF29A928-AB54-4752-9EA6-A05CC8FA6F3C}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeyVerify", "KeyVerify\KeyVerify.csproj", "{808A2A81-2113-4EAA-B595-9C2CD3D61595}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeyCommon", "KeyCommon\KeyCommon.csproj", "{2024F82C-3306-41B5-951C-0B08F7C65590}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeyTest", "KeyTest\KeyTest.csproj", "{1D7BDB7B-C752-4581-A4D7-5E53995D620F}" 15 | EndProject 16 | Global 17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 18 | Debug|Any CPU = Debug|Any CPU 19 | Release|Any CPU = Release|Any CPU 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {69A27771-A916-45AB-8C6F-5E015404EFCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {69A27771-A916-45AB-8C6F-5E015404EFCF}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {69A27771-A916-45AB-8C6F-5E015404EFCF}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {69A27771-A916-45AB-8C6F-5E015404EFCF}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {DF29A928-AB54-4752-9EA6-A05CC8FA6F3C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {DF29A928-AB54-4752-9EA6-A05CC8FA6F3C}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {DF29A928-AB54-4752-9EA6-A05CC8FA6F3C}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {DF29A928-AB54-4752-9EA6-A05CC8FA6F3C}.Release|Any CPU.Build.0 = Release|Any CPU 30 | {808A2A81-2113-4EAA-B595-9C2CD3D61595}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 31 | {808A2A81-2113-4EAA-B595-9C2CD3D61595}.Debug|Any CPU.Build.0 = Debug|Any CPU 32 | {808A2A81-2113-4EAA-B595-9C2CD3D61595}.Release|Any CPU.ActiveCfg = Release|Any CPU 33 | {808A2A81-2113-4EAA-B595-9C2CD3D61595}.Release|Any CPU.Build.0 = Release|Any CPU 34 | {2024F82C-3306-41B5-951C-0B08F7C65590}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 35 | {2024F82C-3306-41B5-951C-0B08F7C65590}.Debug|Any CPU.Build.0 = Debug|Any CPU 36 | {2024F82C-3306-41B5-951C-0B08F7C65590}.Release|Any CPU.ActiveCfg = Release|Any CPU 37 | {2024F82C-3306-41B5-951C-0B08F7C65590}.Release|Any CPU.Build.0 = Release|Any CPU 38 | {1D7BDB7B-C752-4581-A4D7-5E53995D620F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 39 | {1D7BDB7B-C752-4581-A4D7-5E53995D620F}.Debug|Any CPU.Build.0 = Debug|Any CPU 40 | {1D7BDB7B-C752-4581-A4D7-5E53995D620F}.Release|Any CPU.ActiveCfg = Release|Any CPU 41 | {1D7BDB7B-C752-4581-A4D7-5E53995D620F}.Release|Any CPU.Build.0 = Release|Any CPU 42 | EndGlobalSection 43 | GlobalSection(SolutionProperties) = preSolution 44 | HideSolutionNode = FALSE 45 | EndGlobalSection 46 | GlobalSection(ExtensibilityGlobals) = postSolution 47 | SolutionGuid = {3AB11BA6-64C4-4084-BDBC-EFDCA38ED0B7} 48 | EndGlobalSection 49 | EndGlobal 50 | -------------------------------------------------------------------------------- /LicenseEngine/KeyVerify/KeyVerify.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {808A2A81-2113-4EAA-B595-9C2CD3D61595} 8 | Library 9 | Properties 10 | KeyVerify 11 | KeyVerify 12 | v4.5.2 13 | 512 14 | true 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | true 33 | 34 | 35 | bin\Final Release\ 36 | TRACE 37 | true 38 | pdbonly 39 | AnyCPU 40 | 7.3 41 | prompt 42 | MinimumRecommendedRules.ruleset 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | {2024f82c-3306-41b5-951c-0b08f7c65590} 64 | KeyCommon 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /LicenseEngine/KeyVerify/ActivationKeyFileCheck.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Xml; 3 | using KeyCommon; 4 | 5 | namespace KeyVerify 6 | { 7 | // GB 2013/05/09 - Activation Key File functionality is not used in installer 8 | // or program execution as it complicates install, and utilisation of this tool. 9 | // Class made internal so as not to expose as part of API 10 | 11 | /// 12 | /// Provides means of verifying a licence key file 13 | /// 14 | internal /*public*/ class ActivationKeyFileCheck 15 | { 16 | /// 17 | /// Check activation key file for valid licence key or trial period value 18 | /// 19 | /// The absolute local path where the activation key file exists 20 | /// 21 | /// An encryption key which the licence key XML will be decrypted with 22 | /// A friendly application name for error reporting e.g. 'My Licenced Application' 23 | /// 24 | public void CheckActivationKeyFile(string activationKeyFileFullPath, KeyByteSet keyByteSet1, 25 | KeyByteSet keyByteSet2, string licenceKeyFileEncryptionString, string friendlyApplicationName) 26 | { 27 | if (!File.Exists(activationKeyFileFullPath)) 28 | throw new ActivationKeyFileNotPresentException( 29 | "The product activation key file '" + activationKeyFileFullPath + "' was expected at '" + 30 | activationKeyFileFullPath + 31 | "', but was not found. Please visit the vendor website to obtain a product activation key file."); 32 | 33 | var xmlDoc = new XmlDocument(); 34 | xmlDoc.Load(activationKeyFileFullPath); 35 | 36 | var activationCodeEncrypted = xmlDoc.GetElementsByTagName("Key"); 37 | 38 | var activationKeyEncrypted = activationCodeEncrypted[0].InnerText; 39 | 40 | if (!string.IsNullOrEmpty(activationKeyEncrypted)) 41 | { 42 | string clearTextActivationKey; 43 | 44 | try 45 | { 46 | clearTextActivationKey = 47 | ActivationKeyDecryption.Decrypt(activationKeyEncrypted, licenceKeyFileEncryptionString); 48 | } 49 | catch 50 | { 51 | throw new ActivationKeyInvalidException(string.Format( 52 | "The licence key that allows {0} to run is invalid. Please check that the key file exists in the executing directory, and has not been modified.", 53 | friendlyApplicationName)); 54 | } 55 | 56 | // If a check is made, that means that the free trial build period has expired 57 | 58 | if (clearTextActivationKey.ToLower() == "trial") 59 | throw new TrialPeriodExpiredException(string.Format("The trial period for {0} has expired.", 60 | friendlyApplicationName)); 61 | 62 | var pkvLicenceKeyResult = 63 | new KeyCheck().CheckKey(clearTextActivationKey, new[] {keyByteSet1, keyByteSet2}, 8, null); 64 | 65 | if (pkvLicenceKeyResult != LicenseKeyResult.KeyGood) 66 | throw new ActivationKeyInvalidException(string.Format( 67 | "The licence key that allows {0} to run is invalid. Please check that the key file exists in the executing directory, and has not been modified.", 68 | friendlyApplicationName)); 69 | } 70 | } 71 | } 72 | } -------------------------------------------------------------------------------- /LicenseEngine/KeyGenerateUI/MainWindow.xaml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 31 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 65 | 71 | 79 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 |