Table of Contents

Class Licensing

Namespace
BpNexT.NET
Assembly
BpNexT.NET.Core.dll

Provides methods for loading, retrieving, and validating licenses.

public static class Licensing
Inheritance
object
Licensing

Properties

Current

The loaded license of the current (tenant) context, or null if none is loaded.

public static LicenseInfo? Current { get; }

Property Value

LicenseInfo

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

string

Methods

GetLicense()

Retrieves the loaded license.

public static LicenseInfo GetLicense()

Returns

LicenseInfo

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

licensePath string

The path to the license file.

tenantId string

The 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

licenseStr string

The license string.

tenantId string

The 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

name string

The product name as issued in the license.

key string

The 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

licenseServerUrl string
tenantId string

Returns

Task<LicenseVerificationResult>

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

signedData byte[]

The signed data.

moduleSignature string

The module signature.

embeddedLicenseJson string

The license embedded in the module.

Returns

LicenseInfo