Using code:
Easy License is very simple to use, in order to verify a software, you need the following 3 steps.
1:create a public/private Key.
1234567891011121314151617 |
if (file.exists ("Privatekey.xml") | | File.exists ("Publickey.xml")) { var result = MessageBox.Show ("The key is existed, override it?", "Warning", Messageboxbutton.yesno); if (Result = = messageboxresult.no) { return; } } var privatekey = ""; &Nbsp; var publickey = ""; licensegenerator.generatelicensekey (Out privateKey, out publickey); File.writealltext ("Privatekey.xml", Privatekey); file.writealltext ("Publickey.xml", PublicKey); messagebox.show ("The Key is created, please backup it."); |
2:use private key to create a license
1234567891011121314151617 |
if (! File.exists ("Privatekey.xml")) { messagebox.show (" Please create a license key first "); return; } var privatekey = file.readalltext (@ "Privatekey.xml"); var generator = new licensegenerator (PrivateKey); var dictionary = New dictionary<string, string> (); // generate the license var license = generator. Generate ("Easylicense", guid.newguid (), datetime.utcnow.addyears (1), dictionary, licensetype.standard); txtLicense.Text = license; file.writealltext ("License.lic", license); |
3:use public key to validate the license
123456789101112131415161718192021 |
Private static void validatelicense () { if (! File.exists ("Publickey.xml")) { messagebox.show (" Please create a license key first "); return; } var publickey = file.readalltext (@ " Publickey.xml "); var Validator = new licensevalidator (Publickey, @ "License.lic"); try { validator. Assertvalidlicense (); } catch (Exception ex) { console.writeline (ex. Message); } |
Easylicense inside there is a tool called Licensetool, you can download the source code, run, see how it is created key, create Licens and verify license.
650) this.width=650; "Src=" Http://images2015.cnblogs.com/blog/67224/201707/67224-20170704071345050-86729532.png " Style= "margin:0px;padding:0px;border:0px;"/>
And the system also has a demo project that can help you.
650) this.width=650; "Src=" Http://images2015.cnblogs.com/blog/67224/201707/67224-20170704071429034-7324426.png " Style= "margin:0px;padding:0px;border:0px;"/>
Open source. NET License tool, Easylicense!