Class LicenseManager
Provides methods for validating installed license and provided license key.
Inheritance
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 |
---|---|---|
System.String | licenseKey | License key that needs to be encrypted. |
Returns
Type | Description |
---|---|
System.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 |
---|---|
System.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 |
---|---|---|
System.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 |
---|---|
System.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 |
---|---|---|
System.String | licenseKey | License key in the format of "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" to be validated. |
Returns
Type | Description |
---|---|
System.Int32 | True, if key is valid and license is not expired. False, otherwise. |