Class LicenseManager
Provides methods for validating installed license and provided license key.
Inherited Members
Namespace: Nevatech.Vsb.Repository.Security.Licensing
Assembly: Nevatech.Vsb.Repository.dll
Syntax
public static class LicenseManager
Methods
EncryptLicense(String)
Encrypts license key with Data Protection API using the current machine key.
Declaration
public static string EncryptLicense(string licenseKey)
Parameters
| Type | Name | Description |
|---|---|---|
| String | licenseKey | License key that needs to be encrypted. |
Returns
| Type | Description |
|---|---|
| String | Encrypted and Base64-encoded license key. |
EnsureInstalledLicense(LicenseFeatures)
Validates previously installed license and ensures that it is valid and not expired.
Declaration
public static void EnsureInstalledLicense(LicenseFeatures requiredFeatures = LicenseFeatures.None)
Parameters
| Type | Name | Description |
|---|---|---|
| LicenseFeatures | requiredFeatures | Optional list of features that must be enabled in the installed license. |
Exceptions
| Type | Condition |
|---|---|
| UnauthorizedAccessException | Thrown if license is not found, expired or invalid. |
InstallLicense(String)
Installs provided license key on the current machine.
Declaration
public static void InstallLicense(string licenseKey)
Parameters
| Type | Name | Description |
|---|---|---|
| String | licenseKey | License key to be installed. Validity of the key is not checked. |
PrintCurrentLicense()
Returns the string describing the currently installed license.
Declaration
public static string PrintCurrentLicense()
Returns
| Type | Description |
|---|---|
| String | String describing the currently installed license. |
UninstallLicense()
Removes previously installed license from the current machine.
Declaration
public static void UninstallLicense()
ValidateLicense(String)
Validates provided license key and returns True, if key is valid and license is not expired.
Declaration
public static int ValidateLicense(string licenseKey)
Parameters
| Type | Name | Description |
|---|---|---|
| String | licenseKey | License key in the format of "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" to be validated. |
Returns
| Type | Description |
|---|---|
| Int32 | True, if key is valid and license is not expired. False, otherwise. |