public void AddDataObjectKeyTest() { var keydata = new AddDataObjectModel() { }; var auth = AccessToken.AccessToken.DataObjectaAll; var auth2 = activateDeactivate; var license = Key.Activate(token: auth2, parameters: new ActivateModel() { Key = "GEBNC-WZZJD-VJIHG-GCMVD", ProductId = 3349, Sign = true, MachineCode = "foo" }); long id = license.LicenseKey.AddDataObject(auth, new DataObject { }); if (id > 0) { var removeObj = Data.RemoveDataObject(auth, new RemoveDataObjectModel { Id = id }); if (removeObj == null || removeObj.Result == ResultType.Error) { Assert.Fail(); } } else { Assert.Fail(); } }
public Boolean verifyLicense(String licenseKey) { var RSAPubKey = "<RSAKeyValue><Modulus>q3CwN3qAqm2ZbFBrO8f+zJA9e2dkDZskw9tEsgdb+gDiKjKjLPM3Po7fRvfYYgVUjCo84qiul3CKIiU6NuOPIXBMKR4G2itneOjBb+P9zseR/A656lpY7umYOh1xMEBIc9N9jUU2Kw7VsG1ELQj4C5HRqzZZvoBKNAosTiUjcpx9Njg42My0Iy/SnKLcTCrMkCduGD2zZp3N4jWvq2l+4mWu2pHUQ4HymGmR0SU336dDFOEZA8pEzvB3ncPz/BGXJDjWpUU5anj0OG5gAp7iS30kDsfX6x077l3/awZ/aRX+bOgXuvFqY9C2KI3RhZnoHR5A88phMiR7IwqL1y4jgw==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>"; var auth = "WyIzNzM4ODkiLCIrK0loWXhHTFB5U3pOT1V6eGFkOVBrMWIyVVM0Mm1BZnZyMzlqZzExIl0="; var result = Key.Activate(token: auth, parameters: new ActivateModel() { Key = licenseKey, ProductId = 9498, Sign = true, MachineCode = Helpers.GetMachineCode() }); if (result == null || result.Result == ResultType.Error || !result.LicenseKey.HasValidSignature(RSAPubKey).IsValid()) { ConsoleOut("The license does not work."); return(false); } else { // everything went fine if we are here! ConsoleOut("The license is valid!"); return(true); } Console.ReadLine(); }
public void CreateTrialKeyTest() { var newTrialKey = Key.CreateTrialKey(AccessToken.AccessToken.CreateTrialKey, new CreateTrialKeyModel { ProductId = 3941, MachineCode = Helpers.GetMachineCode() }); if (newTrialKey == null || newTrialKey.Result == ResultType.Error) { Assert.Fail("Something went wrong when creating the trial key"); } var activate = Key.Activate(AccessToken.AccessToken.ActivateAllProducts, new ActivateModel { ProductId = 3941, Sign = true, MachineCode = Helpers.GetMachineCode(), Key = newTrialKey.Key, Metadata = true }); if (activate == null || activate.Result == ResultType.Error) { Assert.Fail("Something went wrong when verifying the trial key"); } // now we can verify some basic properties if (Helpers.IsOnRightMachine(activate.LicenseKey)) { // license verification successful. return; } Assert.Fail(); }
public void ActivateAndDeactivateTest() { var auth = activateDeactivate; var result = Key.Activate(token: auth, parameters: new ActivateModel() { Key = "GEBNC-WZZJD-VJIHG-GCMVD", ProductId = 3349, Sign = true, MachineCode = "foo" }); System.Diagnostics.Debug.WriteLine(result); Assert.IsNotNull(result); Assert.IsTrue(result.Result == ResultType.Success); Assert.IsTrue(result.LicenseKey.IsValid(TestCases.TestData.pubkey)); result.LicenseKey.Signature = "test"; Assert.IsFalse(result.LicenseKey.IsValid(TestCases.TestData.pubkey)); var result2 = Key.Deactivate(auth, new DeactivateModel { Key = "GEBNC-WZZJD-VJIHG-GCMVD", ProductId = 3349, MachineCode = "foo" }); if (result2 == null || result2.Result == ResultType.Error) { Assert.Fail("The deactivation did not work"); } }
//// Start is called before the first frame update private void Start() { // We recommend to review https://help.cryptolens.io/getting-started/unity for common errors and tips. var licenseKey = "GEBNC-WZZJD-VJIHG-GCMVD"; var RSAPubKey = "<RSAKeyValue><Modulus>sGbvxwdlDbqFXOMlVUnAF5ew0t0WpPW7rFpI5jHQOFkht/326dvh7t74RYeMpjy357NljouhpTLA3a6idnn4j6c3jmPWBkjZndGsPL4Bqm+fwE48nKpGPjkj4q/yzT4tHXBTyvaBjA8bVoCTnu+LiC4XEaLZRThGzIn5KQXKCigg6tQRy0GXE13XYFVz/x1mjFbT9/7dS8p85n8BuwlY5JvuBIQkKhuCNFfrUxBWyu87CFnXWjIupCD2VO/GbxaCvzrRjLZjAngLCMtZbYBALksqGPgTUN7ZM24XbPWyLtKPaXF2i4XRR9u6eTj5BfnLbKAU5PIVfjIS+vNYYogteQ==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>"; var auth = "WyIyNjg4IiwiN3dVZjVwM2svRU5nNkhEZnpSYWdWZ3R4OUQ5R2ZFVExwbEJMNFZyMCJd"; var result = Key.Activate(token: auth, productId: 3349, key: licenseKey, machineCode: Helpers.GetMachineCodePI()); if (result == null || result.Result == ResultType.Error) { // an error occurred or the key is invalid or it cannot be activated // (eg. the limit of activated devices was achieved) Debug.Log(result?.Message); Debug.Log("The license does not work."); } else { // obtaining the license key (and verifying the signature automatically). var license = LicenseKey.FromResponse(RSAPubKey, result); // make sure to set Max Number of Machines (https://help.cryptolens.io/faq/index#maximum-number-of-machines) // if it's set to zero, please remove "!Helpers.IsOnRightMachinePI(license)". if (license == null || !Helpers.IsOnRightMachinePI(license)) { Debug.Log("The license cannot be used on this device."); return; } // everything went fine if we are here! Debug.Log("The license is valid!"); } }
public void ActivateAndDeactivateTest() { var auth = activateDeactivate; var result = Key.Activate(token: auth, parameters: new ActivateModel() { Key = "GEBNC-WZZJD-VJIHG-GCMVD", ProductId = 3349, Sign = true, MachineCode = "foo" }); System.Diagnostics.Debug.WriteLine(result); //Assert.IsTrue(result.LicenseKey.HasValidSignature("<RSAKeyValue><Modulus>sGbvxwdlDbqFXOMlVUnAF5ew0t0WpPW7rFpI5jHQOFkht/326dvh7t74RYeMpjy357NljouhpTLA3a6idnn4j6c3jmPWBkjZndGsPL4Bqm+fwE48nKpGPjkj4q/yzT4tHXBTyvaBjA8bVoCTnu+LiC4XEaLZRThGzIn5KQXKCigg6tQRy0GXE13XYFVz/x1mjFbT9/7dS8p85n8BuwlY5JvuBIQkKhuCNFfrUxBWyu87CFnXWjIupCD2VO/GbxaCvzrRjLZjAngLCMtZbYBALksqGPgTUN7ZM24XbPWyLtKPaXF2i4XRR9u6eTj5BfnLbKAU5PIVfjIS+vNYYogteQ==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>").IsValid()); Assert.IsNotNull(result); Assert.IsTrue(result.Result == ResultType.Success); Assert.IsTrue(result.LicenseKey.IsValid(TestCases.TestData.pubkey)); result.LicenseKey.Signature = "test"; Assert.IsFalse(result.LicenseKey.IsValid(TestCases.TestData.pubkey)); var result2 = Key.Deactivate(auth, new DeactivateModel { Key = "GEBNC-WZZJD-VJIHG-GCMVD", ProductId = 3349, MachineCode = "foo" }); if (result2 == null || result2.Result == ResultType.Error) { Assert.Fail("The deactivation did not work"); } }
public void AddDataObjectKeyTest() { var keydata = new AddDataObjectModel() { }; var auth = "WyIxMSIsInRFLzRQSzJkT2V0Y1pyN3Y3a1I2Rm9YdmczNUw0SzJTRHJwUERhRFMiXQ=="; var auth2 = activateDeactivate; var license = Key.Activate(token: auth2, parameters: new ActivateModel() { Key = "GEBNC-WZZJD-VJIHG-GCMVD", ProductId = 3349, Sign = true, MachineCode = "foo" }); long id = license.LicenseKey.AddDataObject(auth, new DataObject { }); if (id > 0) { var removeObj = Data.RemoveDataObject(auth, new RemoveDataObjectModel { Id = id }); if (removeObj == null || removeObj.Result == ResultType.Error) { Assert.Fail(); } } else { Assert.Fail(); } }
public void SignatureTestNewMethod() { var result = Key.Activate(AccessToken.AccessToken.Activate, 3349, "MTMPW-VZERP-JZVNZ-SCPZM", "test"); if (result == null || result.Result == ResultType.Error) { Assert.Fail(); } var license = LicenseKey.FromResponse("<RSAKeyValue><Modulus>sGbvxwdlDbqFXOMlVUnAF5ew0t0WpPW7rFpI5jHQOFkht/326dvh7t74RYeMpjy357NljouhpTLA3a6idnn4j6c3jmPWBkjZndGsPL4Bqm+fwE48nKpGPjkj4q/yzT4tHXBTyvaBjA8bVoCTnu+LiC4XEaLZRThGzIn5KQXKCigg6tQRy0GXE13XYFVz/x1mjFbT9/7dS8p85n8BuwlY5JvuBIQkKhuCNFfrUxBWyu87CFnXWjIupCD2VO/GbxaCvzrRjLZjAngLCMtZbYBALksqGPgTUN7ZM24XbPWyLtKPaXF2i4XRR9u6eTj5BfnLbKAU5PIVfjIS+vNYYogteQ==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>", result); Assert.IsNotNull(license); }
public void ActivateAndDeactivateNewProtocolTest() { var auth = activateDeactivate; var result = Key.Activate(token: auth, productId: 3349, key: "GEBNC-WZZJD-VJIHG-GCMVD", machineCode: "foo"); System.Diagnostics.Debug.WriteLine(result); Assert.IsNotNull(result); Assert.IsTrue(result.Result == ResultType.Success); Assert.IsTrue(LicenseKey.FromResponse(TestCases.TestData.pubkey, result) != null); var license = LicenseKey.FromResponse(TestCases.TestData.pubkey, result); license.SaveToFile("newprotocol.skm"); Assert.IsTrue(license.HasValidSignature(TestCases.TestData.pubkey).IsValid()); license = new LicenseKey().LoadFromFile("newprotocol.skm", TestCases.TestData.pubkey); Assert.IsTrue(license != null); license = new LicenseKey().LoadFromFile("newprotocol.skm"); Assert.IsFalse(license != null); var result3 = Key.Activate(auth, new ActivateModel() { ProductId = 3349, Key = "GEBNC-WZZJD-VJIHG-GCMVD", MachineCode = "foo", Sign = true }); result3.LicenseKey.SaveToFile("oldprotocol.skm"); Assert.IsTrue(new LicenseKey().LoadFromFile("oldprotocol.skm") != null); Assert.IsTrue(new LicenseKey().LoadFromFile("oldprotocol.skm", TestCases.TestData.pubkey) != null); //result.LicenseKey.Signature = "test"; //Assert.IsFalse(result.LicenseKey.IsValid(TestCases.TestData.pubkey)); var result2 = Key.Deactivate(auth, new DeactivateModel { Key = "GEBNC-WZZJD-VJIHG-GCMVD", ProductId = 3349, MachineCode = "foo" }); if (result2 == null || result2.Result == ResultType.Error) { Assert.Fail("The deactivation did not work"); } }
static void Main(string[] args) { var licenseKey = "JJWTE-MVKLR-YQMKD-IFXUV"; var RSAPubKey = "<RSAKeyValue><Modulus>wflqVfb+6gkb1lHr1fysux8o+oJREy0M2hM3yEKh92w5rXoc673ZRI9JTg725IqHvr/031TMqFAMvfdQ8X5gB0L3gb3E1tY/QvpZxwobRs6Xpz3XxuGhZ7cIhO9uWLZuykSvoD+PQZMOsdp+M05p9KS4eTsbuSo1w0kwkp6AnumMiG7ICOxYsdGg7YlzX5DN3m6QgG9Fg+6faIOLyBxXktBK4+ligCMNYdRLd3z9UqhGGy4u/Hnz3VD2bzJ99JWQYx00HtXyojmUHi25Yk2G5eki3sQXM7gYzWkZOzaEQ5/rMghp0O3/eJblWtranxQv4HBCm/b8l4oVh4GTcN0x7w==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>"; var auth = "WyIxMDQwIiwiK094dW9yUWxkMitmYTBIaTVQdDBsYXpKenpoUithK2IyQVR3KzlzZCJd"; var result = Key.Activate(token: auth, parameters: new ActivateModel() { Key = licenseKey, ProductId = 3843, Sign = true, MachineCode = Helpers.GetMachineCode() }); if (result == null || result.Result == ResultType.Error || !result.LicenseKey.HasValidSignature(RSAPubKey).IsValid()) { // an error occurred or the key is invalid or it cannot be activated // (eg. the limit of activated devices was achieved) // -------------------new code starts ------------------- // we will try to check for a cached response/certificate var licensefile = new LicenseKey(); if (licensefile.LoadFromFile("licensefile") .HasValidSignature(RSAPubKey, 3) .IsValid()) { Console.WriteLine("The license is valid!"); } else { Console.WriteLine("The license does not work."); } // -------------------new code ends --------------------- } else { // everything went fine if we are here! Console.WriteLine("The license is valid!"); // -------------------new code starts ------------------- // saving a copy of the response/certificate result.LicenseKey.SaveToFile("licensefile"); // -------------------new code ends --------------------- } Console.ReadLine(); }
private bool licenseCheck(string licenseKey) { // From: https://help.cryptolens.io/examples/key-verification var RSAPubKey = "<RSAKeyValue><Modulus>sGbvxwdlDbqFXOMlVUnAF5ew0t0WpPW7rFpI5jHQOFkht/326dvh7t74RYeMpjy357NljouhpTLA3a6idnn4j6c3jmPWBkjZndGsPL4Bqm+fwE48nKpGPjkj4q/yzT4tHXBTyvaBjA8bVoCTnu+LiC4XEaLZRThGzIn5KQXKCigg6tQRy0GXE13XYFVz/x1mjFbT9/7dS8p85n8BuwlY5JvuBIQkKhuCNFfrUxBWyu87CFnXWjIupCD2VO/GbxaCvzrRjLZjAngLCMtZbYBALksqGPgTUN7ZM24XbPWyLtKPaXF2i4XRR9u6eTj5BfnLbKAU5PIVfjIS+vNYYogteQ==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>"; var auth = "WyIxNjY5IiwiZW93b1ZmbFZ2RllVSUF6d1JMcnRpemVTK2Y0eTVvVXlyNHZFWjNSWCJd"; var result = Key.Activate(token: auth, parameters: new ActivateModel() { Key = licenseKey, ProductId = 3941, Sign = true, MachineCode = Helpers.GetMachineCode() }); if (result == null || result.Result == ResultType.Error || !result.LicenseKey.HasValidSignature(RSAPubKey).IsValid()) { // an error occurred or the key is invalid or it cannot be activated // (eg. the limit of activated devices was achieved) return(false); } else { // this is a time-limited license, so check expiration date. if (result.LicenseKey.F1 && !result.LicenseKey.HasNotExpired().IsValid()) { return(false); } // everything went fine if we are here! permittedMethods = new Dictionary <string, bool>(); if (result.LicenseKey.F5) { permittedMethods.Add("Abs", true); } if (result.LicenseKey.F6) { permittedMethods.Add("Factorial", true); } if (result.LicenseKey.F7) { permittedMethods.Add("Fibonacci", true); } return(true); } }
static void Main(string[] args) { var licenseKey = "JJWTE-MVKLR-YQMKD-IFXUV"; var RSAPubKey = "<RSAKeyValue><Modulus>wflqVfb+6gkb1lHr1fysux8o+oJREy0M2hM3yEKh92w5rXoc673ZRI9JTg725IqHvr/031TMqFAMvfdQ8X5gB0L3gb3E1tY/QvpZxwobRs6Xpz3XxuGhZ7cIhO9uWLZuykSvoD+PQZMOsdp+M05p9KS4eTsbuSo1w0kwkp6AnumMiG7ICOxYsdGg7YlzX5DN3m6QgG9Fg+6faIOLyBxXktBK4+ligCMNYdRLd3z9UqhGGy4u/Hnz3VD2bzJ99JWQYx00HtXyojmUHi25Yk2G5eki3sQXM7gYzWkZOzaEQ5/rMghp0O3/eJblWtranxQv4HBCm/b8l4oVh4GTcN0x7w==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>"; var auth = "WyIxMDQwIiwiK094dW9yUWxkMitmYTBIaTVQdDBsYXpKenpoUithK2IyQVR3KzlzZCJd"; var result = Key.Activate(token: auth, parameters: new ActivateModel() { Key = licenseKey, ProductId = 3843, Sign = true, MachineCode = Helpers.GetMachineCode() }); if (result == null || result.Result == ResultType.Error || !result.LicenseKey.HasValidSignature(RSAPubKey).IsValid()) { // an error occurred or the key is invalid or it cannot be activated // (eg. the limit of activated devices was achieved) Console.WriteLine("The license does not work."); } else { // everything went fine if we are here! Console.WriteLine("The license is valid!"); if (result.LicenseKey.HasFeature(1).HasNotExpired().IsValid()) { Console.WriteLine("This is a time-limited license that is still valid in " + result.LicenseKey.DaysLeft() + " day(s)."); } else if (result.LicenseKey.HasNotFeature(1).IsValid()) { Console.WriteLine("This license does not have a time limit."); } else { Console.WriteLine("It appears this license has expired."); } if (result.LicenseKey.HasFeature(3).IsValid()) { Console.WriteLine("You have all features!"); } } Console.ReadLine(); }
public void RefreshTest() { var activateToken = activateDeactivate; var featureToken = "WyI2Iiwib3lFQjFGYk5pTHYrelhIK2pveWdReDdEMXd4ZDlQUFB3aGpCdTRxZiJd"; var license = Key.Activate(token: activateToken, parameters: new ActivateModel() { Key = "GEBNC-WZZJD-VJIHG-GCMVD", ProductId = 3349, Sign = true, MachineCode = "foo" }).LicenseKey; bool feature1 = license.HasFeature(1).IsValid(); license.Refresh(activateToken); // TODO: }
public void FloatingLicensingTest() { var activateToken = activateDeactivate; var res1 = Key.Activate(token: activateToken, parameters: new ActivateModel() { Key = "GEBNC-WZZJD-VJIHG-GCMVD", ProductId = 3349, Sign = true, MachineCode = "test", Metadata = true, FloatingTimeInterval = 10 }); Key.Deactivate(activateToken, new DeactivateModel { Key = "GEBNC-WZZJD-VJIHG-GCMVD", ProductId = 3349, MachineCode = "test", Floating = true }); var res2 = Key.Activate(token: activateToken, parameters: new ActivateModel() { Key = "GEBNC-WZZJD-VJIHG-GCMVD", ProductId = 3349, Sign = true, MachineCode = Helpers.GetMachineCode(), Metadata = true, FloatingTimeInterval = 10, MaxOverdraft = 1 }); Assert.IsTrue(Helpers.IsOnRightMachine(res2.LicenseKey, isFloatingLicense: true, allowOverdraft: true)); var activateModel = new ActivateModel() { Key = "GEBNC-WZZJD-VJIHG-GCMVD", ProductId = 3349, Sign = true, MachineCode = Helpers.GetMachineCode(), Metadata = true, FloatingTimeInterval = 10, MaxOverdraft = 1 }; var activateResult = Key.Activate(token: activateToken, parameters: activateModel); if (activateResult != null && activateResult.Result == ResultType.Success) { var info = Helpers.GetFloatingLicenseInformation(activateModel, activateResult); System.Diagnostics.Debug.WriteLine(info.AvailableDevices); System.Diagnostics.Debug.WriteLine(info.UsedDevices); System.Diagnostics.Debug.WriteLine(info.OverdraftDevices); var a = info.AvailableDevices; } else { Assert.Fail(); } //var result = Key.Activate(token: activateToken, parameters: new ActivateModel() { Key = "GEBNC-WZZJD-VJIHG-GCMVD", ProductId = 3349, Sign = true, MachineCode = Helpers.GetMachineCode(), Metadata = true, FloatingTimeInterval = 100 }); //Assert.IsTrue(result.LicenseKey.ActivatedMachines[0].Mid.StartsWith("floating:")); //Assert.IsTrue(Helpers.IsOnRightMachine(result.LicenseKey, isFloatingLicense: true)); }
public string Key_verification(string key) { string days = null; var licenseKey = key; var RSAPubKey = "<RSAKeyValue><Modulus>tbXLh1SWGzX2davgkaEnHw4n5vlSdCdlxVcfNNHYMGZsBzWMsqiAFoaQZFk+yEFq9Uai+QHZhITIC5g2/MYZgDjjNgMFDkEoE804vn7gv3WNOI9yRSI3THRhNJtHpjA5W4TDCUlf9rRm5TguWJTl4vkYNMO+Axru6qaa/KAZ/jj+VC5lSU+w//yf7OveCXy/iYYyS4U1zrxBELrGBRR3421HYaJ8FKMY2KKFj42yGNhz9KqGo8J6I/mQQmwILhsENgOuz0mZtdf03plcIbqdxBtwbJkUtEDG7m4Z/Re8EC4rn8Zd9H/Kd5v94K1TOzGTyO916J9vaHmq+KCQQAaYQQ==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>"; var auth = "WyI4NDgwIiwia3NYZ21nZUdHSmdTUEc3ODVaaXE2ckRzQyttTkpXSm1rVXE3TE5jUiJd"; var result = Key.Activate(token: auth, parameters: new ActivateModel() { Key = licenseKey, ProductId = 4984, Sign = true, MachineCode = Helpers.GetMachineCode() }); if (result == null || result.Result == ResultType.Error || !result.LicenseKey.HasValidSignature(RSAPubKey).IsValid()) { // an error occurred or the key is invalid or it cannot be activated // (eg. the limit of activated devices was achieved) Properties.Settings.Default.days = 0; return("-1"); } else { // everything went fine if we are here! if (result.LicenseKey.DaysLeft().ToString() == "0") { Properties.Settings.Default.days = 0; return("0"); } else { days = result.LicenseKey.DaysLeft().ToString(); Properties.Settings.Default.days = Convert.ToInt32(days); return(days); } } }
public void LicenseStatusTest() { var test = new LicenseKey(); var res = Newtonsoft.Json.JsonConvert.SerializeObject(test); var activateToken = activateDeactivate; var featureToken = "WyI2Iiwib3lFQjFGYk5pTHYrelhIK2pveWdReDdEMXd4ZDlQUFB3aGpCdTRxZiJd"; var result = Key.Activate(token: activateToken, parameters: new ActivateModel() { Key = "GEBNC-WZZJD-VJIHG-GCMVD", ProductId = 3349, Sign = true, MachineCode = "foo", Metadata = true }); var license = result.LicenseKey; Assert.IsTrue(license.IsValid()); Assert.IsTrue(result.Metadata.LicenseStatus.IsValid); Assert.IsTrue(result.Metadata.VerifySignature("<RSAKeyValue><Modulus>sGbvxwdlDbqFXOMlVUnAF5ew0t0WpPW7rFpI5jHQOFkht/326dvh7t74RYeMpjy357NljouhpTLA3a6idnn4j6c3jmPWBkjZndGsPL4Bqm+fwE48nKpGPjkj4q/yzT4tHXBTyvaBjA8bVoCTnu+LiC4XEaLZRThGzIn5KQXKCigg6tQRy0GXE13XYFVz/x1mjFbT9/7dS8p85n8BuwlY5JvuBIQkKhuCNFfrUxBWyu87CFnXWjIupCD2VO/GbxaCvzrRjLZjAngLCMtZbYBALksqGPgTUN7ZM24XbPWyLtKPaXF2i4XRR9u6eTj5BfnLbKAU5PIVfjIS+vNYYogteQ==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>")); }
public void FloatingLicensingTest() { var activateToken = activateDeactivate; Assert.IsTrue(Key.Activate(token: activateToken, parameters: new ActivateModel() { Key = "GEBNC-WZZJD-VJIHG-GCMVD", ProductId = 3349, Sign = true, MachineCode = Helpers.GetMachineCode(), Metadata = true, FloatingTimeInterval = 100 }).Result == ResultType.Success); Assert.IsTrue(Key.Activate(token: activateToken, parameters: new ActivateModel() { Key = "GEBNC-WZZJD-VJIHG-GCMVD", ProductId = 3349, Sign = true, MachineCode = "foo2", Metadata = true, FloatingTimeInterval = 100 }).Result == ResultType.Error); var result = Key.Activate(token: activateToken, parameters: new ActivateModel() { Key = "GEBNC-WZZJD-VJIHG-GCMVD", ProductId = 3349, Sign = true, MachineCode = Helpers.GetMachineCode(), Metadata = true, FloatingTimeInterval = 100 }); Assert.IsTrue(result.LicenseKey.ActivatedMachines[0].Mid.StartsWith("floating:")); Assert.IsTrue(Helpers.IsOnRightMachine(result.LicenseKey, isFloatingLicense: true)); }
private static void Main(string[] args) { Console.Title = "Lydian Spoofer 1.3.0"; Console.SetWindowSize(72, 30); if (!File.Exists("Lydian Spoofer 1.3.0.exe.config")) { Console.WriteLine("[+]Downloading settings files..."); using (WebClient webClient = new WebClient()) { webClient.DownloadFile("https://cdn.discordapp.com/attachments/698964774096076833/698965202296635402/LydianSpoofer.exe.config", "Lydian Spoofer 1.3.0.exe.config"); } Thread.Sleep(500); FileInfo fileInfo = new FileInfo("Lydian Spoofer 1.3.0.config"); fileInfo.Attributes = FileAttributes.Hidden; MessageBox.Show("Loader needs to restart"); Environment.Exit(0); } foreach (Process process in Process.GetProcessesByName("HWIDBypass")) { process.Kill(); } if (File.Exists("C:\\Users\\Default\\ERDCFVtyb\\NetFresh.kor")) { if (File.Exists("C:\\Windows\\PPKR$5\\register.xfr")) { Console.ForegroundColor = ConsoleColor.Green; Console.Write("[+]Pc is registred: "); Thread.Sleep(500); Console.Clear(); Console.WriteLine(" Welcome to Lydian Spoofer! @ Copyright 2021"); Thread.Sleep(1000); Console.Clear(); Program2.startSpoof(); } else { Console.Write("[+]Enter Your Key License: "); string key = Console.ReadLine(); Console.Clear(); Console.WriteLine("[+]Checking your Key..."); string rsaPublicKey = "<RSAKeyValue><Modulus>0SQ3RqwNvcGHidLrlufXlI+136Rr9XifuWcr3BbKe/+8s5p9rCASO+qSCYx4X7Rei3lcp3tJLFZQmm5YWEASuIMOYJxq5O2jfgka/6Ieetn30jDfDruA82B/PBpUBprTubB1WU0KBOL+eDnXOKApQ0FAfD/yOoR1pRGNYV6thgcvY9/+LXzWiHtUnOIcTrgpzTp8zuYddfRIuHtmn+8Hn6LR4PHZ2sxeyvo1sJxcJzIKljF3Usn0+QQl/deFYm2+yutKc22Nuk8jMa8/X22HNaXOY0o6YUZB5JWFxhT/IZtBN3g6XtGt6ayaW8D1p/nTREmRMbELl3zArkxODzsPYw==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>"; string token = "WyIxNzYxMyIsIjNtLzJtZkxjSEs3TXp0WlNLbjdqZG1xbVAwQUJHNzNiakFHQ2Iyd0kiXQ=="; KeyInfoResult keyInfoResult = Key.Activate(token, new ActivateModel { Key = key, ProductId = 6070, Sign = true, MachineCode = Helpers.GetMachineCode() }); if (keyInfoResult == null || keyInfoResult.Result == ResultType.Error || !keyInfoResult.LicenseKey.HasValidSignature(rsaPublicKey).IsValid()) { SystemSounds.Beep.Play(); DirectoryInfo directoryInfo = new DirectoryInfo("c:\\Users\\Default\\AppData\\Local\\Temp\\Chache"); if (directoryInfo.Exists) { directoryInfo.Delete(true); } Console.Clear(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("[+]Invalid License or Expired."); Thread.Sleep(1500); Console.Clear(); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("[+]You Can buy your Key From our Store:"); Thread.Sleep(1000); Process.Start(new ProcessStartInfo("iexplore.exe") { Arguments = "https://lydian.selly.store/" }); Thread.Sleep(3500); Environment.Exit(0); } Console.WriteLine(" Welcome to Lydian Spoofer! @ Copyright 2020"); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("[+]The license is valid: " + keyInfoResult.LicenseKey.DaysLeft() + " Day(s) Left. "); Thread.Sleep(2000); File.Delete("C:\\Windows\\AMIDEWINx64.exe"); File.Delete("C:\\Windows\\amifldrv64.sys"); Program2.startSpoof(); } } else { Console.Write("[+]Enter Your Key License: "); string key2 = Console.ReadLine(); Console.Clear(); Console.WriteLine("[+]Checking your Key..."); string rsaPublicKey2 = "<RSAKeyValue><Modulus>0SQ3RqwNvcGHidLrlufXlI+136Rr9XifuWcr3BbKe/+8s5p9rCASO+qSCYx4X7Rei3lcp3tJLFZQmm5YWEASuIMOYJxq5O2jfgka/6Ieetn30jDfDruA82B/PBpUBprTubB1WU0KBOL+eDnXOKApQ0FAfD/yOoR1pRGNYV6thgcvY9/+LXzWiHtUnOIcTrgpzTp8zuYddfRIuHtmn+8Hn6LR4PHZ2sxeyvo1sJxcJzIKljF3Usn0+QQl/deFYm2+yutKc22Nuk8jMa8/X22HNaXOY0o6YUZB5JWFxhT/IZtBN3g6XtGt6ayaW8D1p/nTREmRMbELl3zArkxODzsPYw==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>"; string token2 = "WyIxNzYxMyIsIjNtLzJtZkxjSEs3TXp0WlNLbjdqZG1xbVAwQUJHNzNiakFHQ2Iyd0kiXQ=="; KeyInfoResult keyInfoResult2 = Key.Activate(token2, new ActivateModel { Key = key2, ProductId = 6070, Sign = true, MachineCode = Helpers.GetMachineCode() }); if (keyInfoResult2 == null || keyInfoResult2.Result == ResultType.Error || !keyInfoResult2.LicenseKey.HasValidSignature(rsaPublicKey2).IsValid()) { SystemSounds.Beep.Play(); DirectoryInfo directoryInfo2 = new DirectoryInfo("c:\\Users\\Default\\AppData\\Local\\Temp\\Chache"); if (directoryInfo2.Exists) { directoryInfo2.Delete(true); } Console.Clear(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("[+]Invalid License or Expired."); Thread.Sleep(1500); Console.Clear(); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("[+]You Can buy your Key From our Store:"); Thread.Sleep(1000); Process.Start(new ProcessStartInfo("iexplore.exe") { Arguments = "https://lydian.selly.store/" }); Thread.Sleep(3500); Environment.Exit(0); } Console.WriteLine(" Welcome to Lydian Spoofer! @ Copyright 2020"); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("[+]The license is valid: " + keyInfoResult2.LicenseKey.DaysLeft() + " Day(s) Left. "); Thread.Sleep(2000); File.Delete("C:\\Windows\\AMIDEWINx64.exe"); File.Delete("C:\\Windows\\amifldrv64.sys"); Program2.startSpoof(); } }
static void Main(string[] args) { Console.WriteLine("Cryptolens Assembly Signer (command-line) v1.0"); Console.WriteLine("Copyright (c) 2019 Cryptolens AB. All rights reserved.\n"); Console.WriteLine("--------------------------------------------------------------------"); Console.WriteLine($"This tool helps you to automatically sign multiple assemblies.\n" + $"All configurations about where these assemblies are located should \n" + $"be put into build.json in the same folder as this file. If you want\n" + $"to read build.json from a different folder, please supply it as an\n" + $"argument to this application. This file should also have a valid \n" + $"license key supplied.\n\n" + $"For more information, please check \n" + $" > https://github.com/Cryptolens/sdk-licensing/blob/master/Developer.md"); Console.WriteLine("--------------------------------------------------------------------\n"); string asmDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); VendorConfig vendorConfig; try { vendorConfig = JsonConvert.DeserializeObject <VendorConfig>(System.IO.File.ReadAllText(Path.Combine(asmDir, "config.json"))); } catch (Exception ex) { Console.WriteLine("Error: could not find config.json. Please contact the vendor."); return; } string pathToUserConfig = Path.Combine(asmDir, "build.json"); if (args.Length != 0) { pathToUserConfig = args[0]; } var userConfig = JsonConvert.DeserializeObject <UserConfig>(System.IO.File.ReadAllText(pathToUserConfig)); if (userConfig.Assemblies == null || userConfig.Assemblies.Count == 0) { Console.WriteLine("Error: No assembly paths specified."); return; } SHA512 sha = SHA512.Create(); var response = Key.Activate(vendorConfig.ActivateToken, new ActivateModel { ProductId = vendorConfig.ProductId, Key = userConfig.Key, MachineCode = Helpers.GetMachineCodePI() }); if (!Helpers.IsSuccessful(response)) { Console.WriteLine($"Error: Could not activate the following device, {(response != null ? response.Message : "")}. Please contact the vendor to increase the number of end users for this license key."); return; } long dObjId = -1; foreach (var dObj in response.LicenseKey.DataObjects) { if (dObj.Name == "cryptolens_assemblyhash") { dObjId = dObj.Id; break; } } if (dObjId == -1) { var dObjRes = Data.AddDataObject(vendorConfig.DataObjectToken, new AddDataObjectToKeyModel { Name = "cryptolens_assemblyhash", ProductId = vendorConfig.ProductId, StringValue = "", Key = userConfig.Key, CheckForDuplicates = true }); if (!Helpers.IsSuccessful(dObjRes)) { Console.WriteLine($"Warning: Could not add data object, '{(dObjRes != null ? dObjRes.Message : "")}'."); } else { dObjId = dObjRes.Id; } } Directory.SetCurrentDirectory(Path.GetDirectoryName(pathToUserConfig)); foreach (var path in userConfig.Assemblies) { if (string.IsNullOrEmpty(path) || !File.Exists(path)) { Console.WriteLine($"Warning: incorrect path, '{path}'. Ignoring it."); continue; } var dir = Path.GetDirectoryName(path); using (var stream = File.OpenRead(path)) { var sig = Convert.ToBase64String(sha.ComputeHash(stream)); Data.SetStringValue(vendorConfig.DataObjectToken, new ChangeStringValueToKeyModel { Id = dObjId, Key = userConfig.Key, ProductId = vendorConfig.ProductId, StringValue = sig }); var cert = Key.Activate(vendorConfig.ActivateToken, vendorConfig.ProductId, userConfig.Key, Helpers.GetMachineCodePI()); var certName = Path.Combine(dir, Path.GetFileName(path) + ".skm"); File.WriteAllText(certName, JsonConvert.SerializeObject(cert)); Console.WriteLine($"Assembly {path} was successfully signed."); } } Console.WriteLine("Process complete."); }
private void Button2_Click(object sender, EventArgs e) { SHA512 sha = SHA512.Create(); var key = textBox1.Text; var response = Key.Activate(vendorConfig.ActivateToken, new ActivateModel { ProductId = vendorConfig.ProductId, Key = key, MachineCode = Helpers.GetMachineCodePI() }); if (!Helpers.IsSuccessful(response)) { MessageBox.Show($"Error: Could not activate the following device, {(response != null ? response.Message : "")}. Please contact the vendor to increase the number of end users for this license key."); return; } long dObjId = -1; foreach (var dObj in response.LicenseKey.DataObjects) { if (dObj.Name == "cryptolens_assemblyhash") { dObjId = dObj.Id; break; } } if (dObjId == -1) { var dObjRes = Data.AddDataObject(vendorConfig.DataObjectToken, new AddDataObjectToKeyModel { Name = "cryptolens_assemblyhash", ProductId = vendorConfig.ProductId, StringValue = "", Key = key, CheckForDuplicates = true }); if (!Helpers.IsSuccessful(dObjRes)) { Console.WriteLine($"Warning: Could not add data object, '{(dObjRes != null ? dObjRes.Message : "")}'."); } else { dObjId = dObjRes.Id; } } var path = textBox2.Text; if (string.IsNullOrEmpty(path) || !File.Exists(path)) { MessageBox.Show("Incorrect path. File not found."); return; } var dir = Path.GetDirectoryName(path); using (var stream = File.OpenRead(path)) { var sig = Convert.ToBase64String(sha.ComputeHash(stream)); Data.SetStringValue(vendorConfig.DataObjectToken, new ChangeStringValueToKeyModel { Id = dObjId, Key = key, ProductId = vendorConfig.ProductId, StringValue = sig }); var cert = Key.Activate(vendorConfig.ActivateToken, vendorConfig.ProductId, key, Helpers.GetMachineCodePI()); var certName = Path.Combine(dir, Path.GetFileName(path) + ".skm"); File.WriteAllText(certName, JsonConvert.SerializeObject(cert)); MessageBox.Show($"Assembly {path} was successfully signed."); } }