Class Licensing
- Namespace
- BpNexT.NET
- Assembly
- BpNexT.NET.Core.dll
Provides methods for loading, retrieving, and validating licenses.
public static class Licensing
- Inheritance
-
objectLicensing
Properties
Current
The loaded license of the current (tenant) context, or null if none is loaded.
public static LicenseInfo? Current { get; }
Property Value
ProductName
No longer used. SDK licenses need no product name; product licenses use SetProduct(string, string).
[Obsolete("No longer evaluated. SDK licenses need no product name; product licenses use Licensing.SetProduct(name, key).")]
public static string? ProductName { get; set; }
Property Value
Methods
GetLicense()
Retrieves the loaded license.
public static LicenseInfo GetLicense()
Returns
Exceptions
- LicenseException
Thrown if the license is not loaded.
LoadLicenseFromFile(string, string?)
Loads a license from a file.
public static void LoadLicenseFromFile(string licensePath, string? tenantId = null)
Parameters
licensePathstringThe path to the license file.
tenantIdstringThe tenant ID for which to load the license. If null, sets the default license.
Exceptions
- FileNotFoundException
Thrown if the license file is not found.
- FileLoadException
Thrown if the license file is empty.
- LicenseException
Thrown if the license is outdated or its signature is invalid.
LoadLicenseFromString(string, string?)
Loads a license from a string.
public static void LoadLicenseFromString(string licenseStr, string? tenantId = null)
Parameters
licenseStrstringThe license string.
tenantIdstringThe tenant ID for which to load the license. If null, sets the default license.
Exceptions
- LicenseException
Thrown if the license is outdated or its signature is invalid.
SetProduct(string, string)
Binds this application to a product license. Required when the license is a product license (e.g. shipped by an OEM); not needed for SDK licenses.
public static void SetProduct(string name, string key)
Parameters
namestringThe product name as issued in the license.
keystringThe secret product key issued together with the license.
ValidateLicense()
Validates the loaded license: signature, expiry, and either the SDK entitlement or a product license matching SetProduct(string, string).
public static void ValidateLicense()
Exceptions
- LicenseException
Thrown if the license is not loaded or is invalid.
VerifyLicenseAsync(string?, string?)
Verifies the license online with the license server. A renewed license returned by the server replaces the loaded one in memory; persist RenewedLicenseJson to keep it across restarts.
public static Task<LicenseVerificationResult> VerifyLicenseAsync(string? licenseServerUrl = null, string? tenantId = null)
Parameters
Returns
VerifyModule(byte[], string, string)
Verifies a signed module. Returns the module's license information if the signature is valid, otherwise null.
public static LicenseInfo? VerifyModule(byte[] signedData, string moduleSignature, string embeddedLicenseJson)
Parameters
signedDatabyte[]The signed data.
moduleSignaturestringThe module signature.
embeddedLicenseJsonstringThe license embedded in the module.