/AutoLicensing

This package provides an open-source license manager.

Primary LanguageC#

AutoLicensing

NuGet

This package provides an open-source license manager.

Usage

Use this command to add AutoLicensing to your project.

dotnet add package AutoLicensing --version 1.0.5

Generate license

    var key = LicenseKeyGenerator.GenerateRsaKeyPair();

    var privateKey = key.PrivateKey;
    var publicKey = key.PublicKey;

    var signedLicense = new LicenseFactory()
        .WithRsaPrivateKey(key.PrivateKey)
        .WithName("Enterprise License")
        .WithCustomerName("Some Guy")
        .WithProduct(new LicenseProductFactory()
            .WithName("Application 1")
            .WithExpiryDate(DateTime.Now.AddDays(180))
            .WithAttribute("Limitation 1", 100)
            .WithFeature("Feature 1")
            .WithFeature("Feature 2")
            .Create())
        .SignAndCreate();

        var licenseKey = signedLicense.Export();

Verify license

    var signedLicense = Licenser.Verifier
        .WithRsaPublicKey(publicKey)
        .LoadAndVerify(licenseKey);

Misc.

You can change the confusing bytes by using this code

    Confuser.ConfusingBytes = "Some random bytes"u8.ToArray();