> ## Documentation Index
> Fetch the complete documentation index at: https://help.cryptolens.io/llms.txt
> Use this file to discover all available pages before exploring further.

# .NET: Helpers

> Signatures, models and behavior for SKM.V3.Methods.Helpers in the .NET SDK 4.0.54.

Helper methods for working with licenses, signatures, machine codes and Web API results.

**Namespace:** `SKM.V3.Methods`\
**Version:** 4.0.54. Both packages; all six documented target frameworks.

<CodeGroup>
  ```csharp C# theme={null}
  public static class Helpers
  ```

  ```vb VB.NET theme={null}
  Public Module Helpers
  ```
</CodeGroup>

## Properties

<a id="windows-only-cb6047d916" />

### WindowsOnly

Only set this setting if you plan to target Windows only. It's only necessary in rare cases.
If you have any questions, please contact [support@cryptolens.io](mailto:support@cryptolens.io).

<CodeGroup>
  ```csharp C# theme={null}
  public static bool WindowsOnly { get; set; }
  ```

  ```vb VB.NET theme={null}
  Public Shared Property WindowsOnly As Boolean
  ```
</CodeGroup>

**Type:** `bool`

## Methods

<a id="compute-password-hash-02adde39de" />

### ComputePasswordHash(string)

Computes a string hash of a password using PBKDF2. Note, in comparison to using hash
algorithms such as SHA256, the algorithm used in this method slows down the computation on
purpose, to make sure it is harder to guess the original password.

<CodeGroup>
  ```csharp C# theme={null}
  public static string ComputePasswordHash(string password)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function ComputePasswordHash(password As String) As String
  ```
</CodeGroup>

**Parameters**

| Name | Type | Description |
| - | - | - |
| `password` | `string` | |

**Returns:** `string`. A Base64-encoded JSON pair containing the salt and derived password hash.

**Checks:** Uses PBKDF2 with 50,000 iterations and a 32-byte derived value. A random 32-byte salt is generated when salt is null.

**Failure Behavior:** Invalid password or salt arguments can throw.

<a id="compute-password-hash-eaae802373" />

### ComputePasswordHash(string, byte\[])

Computes a string hash of a password using PBKDF2. Note, in comparison to using hash
algorithms such as SHA256, the algorithm used in this method slows down the computation on
purpose, to make sure it is harder to guess the original password.

<CodeGroup>
  ```csharp C# theme={null}
  public static string ComputePasswordHash(string password, byte[] salt = null)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function ComputePasswordHash(password As String, salt As Byte() = Nothing) As String
  ```
</CodeGroup>

**Parameters**

| Name | Type | Description |
| - | - | - |
| `password` | `string` | |
| `salt` | `Byte[]` | |

**Returns:** `string`. A Base64-encoded JSON pair containing the salt and derived password hash.

**Checks:** Uses PBKDF2 with 50,000 iterations and a 32-byte derived value. A random 32-byte salt is generated when salt is null.

**Failure Behavior:** Invalid password or salt arguments can throw.

<a id="get-assembly-hash-8c80fef3c2" />

### GetAssemblyHash()

Computes a SHA-512 hash of the selected assembly file.

<CodeGroup>
  ```csharp C# theme={null}
  public static AssemblySignature GetAssemblyHash()
  ```

  ```vb VB.NET theme={null}
  Public Shared Function GetAssemblyHash() As AssemblySignature
  ```
</CodeGroup>

**Returns:** [`AssemblySignature`](/libraries/dotnet-reference/models/assembly-signature). An AssemblySignature containing the file path and Base64 hash, or null if the file cannot be found or read.

**Failure Behavior:** An unavailable entry assembly can throw when no path is supplied.

With no path, this uses `Assembly.GetEntryAssembly()`. It does not verify a license or sign the assembly.

<a id="get-assembly-hash-9ae6e634a9" />

### GetAssemblyHash(string)

Computes a SHA-512 hash of the selected assembly file.

<CodeGroup>
  ```csharp C# theme={null}
  public static AssemblySignature GetAssemblyHash(string path)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function GetAssemblyHash(path As String) As AssemblySignature
  ```
</CodeGroup>

**Parameters**

| Name | Type | Description |
| - | - | - |
| `path` | `string` | The full path of the assembly file to hash. If null, uses the entry assembly. |

**Returns:** [`AssemblySignature`](/libraries/dotnet-reference/models/assembly-signature). An AssemblySignature containing the file path and Base64 hash, or null if the file cannot be found or read.

**Failure Behavior:** An unavailable entry assembly can throw when no path is supplied.

With no path, this uses `Assembly.GetEntryAssembly()`. It does not verify a license or sign the assembly.

<a id="get-floating-license-information-9e2ad95dbe" />

### GetFloatingLicenseInformation(ActivateModel, KeyInfoResult)

Calculates used, available and overdraft seats from supplied floating-license counts.

<CodeGroup>
  ```csharp C# theme={null}
  public static FloatingLicenseInformation GetFloatingLicenseInformation(ActivateModel activationModel, KeyInfoResult activationResult)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function GetFloatingLicenseInformation(activationModel As ActivateModel, activationResult As KeyInfoResult) As FloatingLicenseInformation
  ```
</CodeGroup>

**Parameters**

| Name | Type | Description |
| - | - | - |
| `activationModel` | [`ActivateModel`](/libraries/dotnet-reference/models/activate-model) | See [`ActivateModel`](/libraries/dotnet-reference/models/activate-model). |
| `activationResult` | [`KeyInfoResult`](/libraries/dotnet-reference/models/key-info-result) | See [`KeyInfoResult`](/libraries/dotnet-reference/models/key-info-result). |

**Returns:** [`FloatingLicenseInformation`](/libraries/dotnet-reference/methods/floating-license-information). FloatingLicenseInformation with UsedDevices, AvailableDevices and OverdraftDevices.

**Checks:** This is a calculation; it does not contact the server or renew a seat.

**Failure Behavior:** The response overload requires non-null activation, license and metadata objects.

AvailableDevices is MaxNoOfMachines + MaxOverdraft - UsedFloatingMachines. The caller must supply current counts; the result is not a live occupancy query.

<a id="get-floating-license-information-8f79a6bd52" />

### GetFloatingLicenseInformation(int, int, int)

Calculates used, available and overdraft seats from supplied floating-license counts.

<CodeGroup>
  ```csharp C# theme={null}
  public static FloatingLicenseInformation GetFloatingLicenseInformation(int MaxOverdraft, int MaxNoOfMachines, int UsedFloatingMachines)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function GetFloatingLicenseInformation(MaxOverdraft As Integer, MaxNoOfMachines As Integer, UsedFloatingMachines As Integer) As FloatingLicenseInformation
  ```
</CodeGroup>

**Parameters**

| Name | Type | Description |
| - | - | - |
| `MaxOverdraft` | `int` | |
| `MaxNoOfMachines` | `int` | |
| `UsedFloatingMachines` | `int` | |

**Returns:** [`FloatingLicenseInformation`](/libraries/dotnet-reference/methods/floating-license-information). FloatingLicenseInformation with UsedDevices, AvailableDevices and OverdraftDevices.

**Checks:** This is a calculation; it does not contact the server or renew a seat.

**Failure Behavior:** The response overload requires non-null activation, license and metadata objects.

AvailableDevices is MaxNoOfMachines + MaxOverdraft - UsedFloatingMachines. The caller must supply current counts; the result is not a live occupancy query.

<a id="get-hardisk-id-f9dbc82e34" />

### GetHardiskId()

An alternative way to compute the machine code by relying on the Hardisk Id (assigned by the manufacturer).
This is different from Volume Id. Please note: although based on our testing, it should run without admin
access, this might not be the case on some machines. Furthermore, this method is specific to Windows and cannot
be used on other platforms.

<CodeGroup>
  ```csharp C# theme={null}
  [SecuritySafeCritical]
  public static string GetHardiskId()
  ```

  ```vb VB.NET theme={null}
  <SecuritySafeCritical>
  Public Shared Function GetHardiskId() As String
  ```
</CodeGroup>

**Availability:** Standard package: .NET Framework 3.5, .NET Framework 4.6, .NET Framework 4.7, .NET Framework 4.7.1, .NET Framework 4.8, .NET Standard 2.0.

**Returns:** `string`. The model and serial number from the last disk returned by the Windows management query, or an empty string when no disk is returned.

**Failure Behavior:** Management-query and missing-field errors can throw. Available only in the standard package.

<a id="get-macaddress-fe13ca143d" />

### GetMACAddress()

Returns the MAC address of the first active network interface.

<CodeGroup>
  ```csharp C# theme={null}
  public static string GetMACAddress()
  ```

  ```vb VB.NET theme={null}
  Public Shared Function GetMACAddress() As String
  ```
</CodeGroup>

**Returns:** `string`. The physical address of the first active network interface, or null if none is found.

**Failure Behavior:** Network-interface enumeration can throw.

Interface selection can change. This helper does not guarantee a permanent or unique device identity.

<a id="get-machine-code-b938b50c10" />

### GetMachineCode(bool, int)

Returns the machine code of the current device with SHA-256 as the hash function.
This method works differently depending on the binaries that you use. By default,
machine code is computed using COM, which requires System.Management. This is only
supported on Windows, it's better to set platformIndependent=true. If you use a version
of library without System.Management, the platform independent machine code will be
computed by default.

The supported platforms are Windows, Mac and Linux. Note, sudo access is required if
Linux is used.

In newer projects, we recommend to always set platformIndependent=true or use
[`GetMachineCodePI()`](/libraries/dotnet-reference/methods/helpers#get-machine-code-pi-78312fdca7).

If version is set to 2, you can get the machine code as in the Python client,
assuming similar settings are used. You can read more about it here:
[https://help.cryptolens.io/faq/index#machine-code-generation](https://help.cryptolens.io/faq/index#machine-code-generation)

Standard package: .NET Framework 3.5, .NET Framework 4.6, .NET Framework 4.7, .NET Framework 4.7.1, .NET Framework 4.8, .NET Standard 2.0.

<CodeGroup>
  ```csharp C# theme={null}
  [Obsolete]
  [SecuritySafeCritical]
  public static string GetMachineCode(bool platformIndependent = false, int v = 1)
  ```

  ```vb VB.NET theme={null}
  <Obsolete>
  <SecuritySafeCritical>
  Public Shared Function GetMachineCode( Optional platformIndependent As Boolean = False, Optional v As Integer = 1) As String
  ```
</CodeGroup>

Cross-platform package: .NET Framework 3.5, .NET Framework 4.6, .NET Framework 4.7, .NET Framework 4.7.1, .NET Framework 4.8, .NET Standard 2.0.

<CodeGroup>
  ```csharp C# theme={null}
  [SecuritySafeCritical]
  public static string GetMachineCode(bool platformIndependent = false, int v = 1)
  ```

  ```vb VB.NET theme={null}
  <SecuritySafeCritical>
  Public Shared Function GetMachineCode( Optional platformIndependent As Boolean = False, Optional v As Integer = 1) As String
  ```
</CodeGroup>

**Parameters**

| Name | Type | Description |
| - | - | - |
| `platformIndependent` | `bool` | |
| `v` | `int` | |

**Returns:** `string`. A machine-code string, or null for some collection failures. Platform-command and access failures can also throw.

This helper uses older Windows/System.Management behavior in the standard package. Prefer `GetMachineCodePI` for new cross-platform integrations, or pass an explicit machine code to the matching helper. The API availability table describes compilation, not whether a platform-specific operation will succeed on every OS.

<a id="get-machine-code-pi-78312fdca7" />

### GetMachineCodePI()

Computes a machine code using the SDK's platform-independent helper.

<CodeGroup>
  ```csharp C# theme={null}
  public static string GetMachineCodePI()
  ```

  ```vb VB.NET theme={null}
  Public Shared Function GetMachineCodePI() As String
  ```
</CodeGroup>

**Returns:** `string`. A machine-code string. Some collection failures return null; exceptions from platform-specific collection can also propagate.

The overload with `v` defaults to 1. Keep the same version for activation and later checks. Both packages use the platform-independent path here. On Windows, version 2 tries the hardware UUID and then MachineGuid if the UUID is unavailable; version 1 depends on WMIC. Linux and macOS use platform commands. The host must allow the commands and access needed to read the device identity.

<a id="get-machine-code-pi-09e3a1c2eb" />

### GetMachineCodePI(int)

Computes a machine code using the SDK's platform-independent helper.

<CodeGroup>
  ```csharp C# theme={null}
  public static string GetMachineCodePI(int v = 1)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function GetMachineCodePI( Optional v As Integer = 1) As String
  ```
</CodeGroup>

**Parameters**

| Name | Type | Description |
| - | - | - |
| `v` | `int` | |

**Returns:** `string`. A machine-code string. Some collection failures return null; exceptions from platform-specific collection can also propagate.

The overload with `v` defaults to 1. Keep the same version for activation and later checks. Both packages use the platform-independent path here. On Windows, version 2 tries the hardware UUID and then MachineGuid if the UUID is unavailable; version 1 depends on WMIC. Linux and macOS use platform commands. The host must allow the commands and access needed to read the device identity.

<a id="get-osstats-c570c8d419" />

### GetOSStats()

Creates a JSON dictionary of the type [`MachineInfo`](/libraries/dotnet-reference/models/machine-info), which contains OSVersion, OSName and Is64Bit (not available in NET 3.5).

<CodeGroup>
  ```csharp C# theme={null}
  public static string GetOSStats()
  ```

  ```vb VB.NET theme={null}
  Public Shared Function GetOSStats() As String
  ```
</CodeGroup>

**Returns:** `string`. A string representation of the JSON dictionary.

<a id="get-platform-58b17fcfbc" />

### GetPlatform()

Identifies the operating-system family for the current runtime.

<CodeGroup>
  ```csharp C# theme={null}
  public static Helpers.OSType GetPlatform()
  ```

  ```vb VB.NET theme={null}
  Public Shared Function GetPlatform() As Helpers.OSType
  ```
</CodeGroup>

**Returns:** [`Helpers.OSType`](/libraries/dotnet-reference/methods/helpers/ostype). An OSType value. The available detection path depends on the target framework.

<a id="has-feature-2764cc0a80" />

### HasFeature(LicenseKey, int)

Checks so that a certain Feature is enabled (i.e. it's set to TRUE).

<CodeGroup>
  ```csharp C# theme={null}
  public static bool HasFeature(LicenseKey licenseKey, int featureNumber)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function HasFeature(licenseKey As LicenseKey, featureNumber As Integer) As Boolean
  ```
</CodeGroup>

**Parameters**

| Name | Type | Description |
| - | - | - |
| `licenseKey` | [`LicenseKey`](/libraries/dotnet-reference/license-key) | The license object to check or use. |
| `featureNumber` | `int` | The feature number, eg. feature1, feature 2, etc. FeatureNumber can be 1,2,...,8. |

**Returns:** `bool`. True when the license is non-null, the feature number is between 1 and 8, and that feature is enabled; otherwise false.

<a id="has-feature-4cad6a4b7a" />

### HasFeature(LicenseKey, string)

Uses a special data object associated with the license key to determine if a certain feature exists (instead of the 8 feature flags).

**Formatting:**  The name of the data object should be 'cryptolens\_features' and it should be structured as a JSON array.

For example,

```text theme={null}
["f1", "f2"]
```

means f1 and f2 are true. You can also have feature bundling, eg.

```text theme={null}
["f1", ["f2",["voice","image"]]]
```

which means that f1 and f2 are true, as well as f2.voice and f2.image. You can set any depth, eg. you can have

```text theme={null}
["f1", ["f2",[["voice",["all"]], "image"]]]
```

means f2.voice.all is true as well as f2.voice and f2.
The dots symbol is used to specify the "sub-features".

Read more here: [https://help.cryptolens.io/web-interface/feature-templates](https://help.cryptolens.io/web-interface/feature-templates)

<CodeGroup>
  ```csharp C# theme={null}
  public static bool HasFeature(LicenseKey licenseKey, string featureName)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function HasFeature(licenseKey As LicenseKey, featureName As String) As Boolean
  ```
</CodeGroup>

**Parameters**

| Name | Type | Description |
| - | - | - |
| `licenseKey` | [`LicenseKey`](/libraries/dotnet-reference/license-key) | The license key |
| `featureName` | `string` | For example, "f2.voice.all". |

**Returns:** `bool`. True if the requested feature path is found; false when the feature data or a path segment is absent.

**Checks:** Reads the cryptolens\_features data object. Does not verify the license signature.

**Failure Behavior:** Malformed feature JSON or unexpected data shapes can throw.

<a id="is-on-right-machine-77ec79dd82" />

### IsOnRightMachine(LicenseKey, bool, bool, bool)

Checks whether the supplied license lists the expected machine or process identity.

<CodeGroup>
  ```csharp C# theme={null}
  [SecuritySafeCritical]
  public static bool IsOnRightMachine(LicenseKey licenseKey, bool isFloatingLicense = false, bool allowOverdraft = false, bool platformIndependent = false)
  ```

  ```vb VB.NET theme={null}
  <SecuritySafeCritical>
  Public Shared Function IsOnRightMachine(licenseKey As LicenseKey, Optional isFloatingLicense As Boolean = False, Optional allowOverdraft As Boolean = False, Optional platformIndependent As Boolean = False) As Boolean
  ```
</CodeGroup>

**Parameters**

| Name | Type | Description |
| - | - | - |
| `licenseKey` | [`LicenseKey`](/libraries/dotnet-reference/license-key) | The license key object. |
| `isFloatingLicense` | `bool` | If this is a floating license, this parameter has to be set to true.<br />     You can enable floating licenses by setting [`FloatingTimeInterval`](/libraries/dotnet-reference/models/activate-model#floating-time-interval-d289bcb738)<br />     to a value greater than 0. |
| `allowOverdraft` | `bool` | If floating licensing is enabled with overdraft, this parameter should be set to true.<br />     You can enable overdraft by setting [`MaxOverdraft`](/libraries/dotnet-reference/models/activate-model#max-overdraft-ac4eb42989) to a value greater than 0. |
| `platformIndependent` | `bool` | Allows you to specify if you want to use the old machine code method that is based on COM and requires<br />     System.Management or use the new platform independent method, i.e. [`GetMachineCodePI()`](/libraries/dotnet-reference/methods/helpers#get-machine-code-pi-78312fdca7). |

**Returns:** `bool`. True when a matching activation is present; false otherwise.

**Checks:** Matches activation identifiers. It does not check the signature, expiry, blocking or floating-seat deadline.

Machine binding requires **Maximum Number of Machines greater than 0**. For floating licenses, use `isFloatingLicense=true` and reuse the same process ID for renewals. The overload with an explicit machine code avoids recomputing it. `allowOverdraft` defaults to false.

<a id="is-on-right-machine-82a0b194d0" />

### IsOnRightMachine(LicenseKey, string, bool, bool)

Checks whether the supplied license lists the expected machine or process identity.

<CodeGroup>
  ```csharp C# theme={null}
  public static bool IsOnRightMachine(LicenseKey licenseKey, string machineCode, bool isFloatingLicense = false, bool allowOverdraft = false)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function IsOnRightMachine(licenseKey As LicenseKey, machineCode As String, Optional isFloatingLicense As Boolean = False, Optional allowOverdraft As Boolean = False) As Boolean
  ```
</CodeGroup>

**Parameters**

| Name | Type | Description |
| - | - | - |
| `licenseKey` | [`LicenseKey`](/libraries/dotnet-reference/license-key) | The license key object. |
| `machineCode` | `string` | A unique identifier of the machine. |
| `isFloatingLicense` | `bool` | If this is a floating license, this parameter has to be set to true.<br />     You can enable floating licenses by setting [`FloatingTimeInterval`](/libraries/dotnet-reference/models/activate-model#floating-time-interval-d289bcb738)<br />     to a value greater than 0. |
| `allowOverdraft` | `bool` | If floating licensing is enabled with overdraft, this parameter should be set to true.<br />     You can enable overdraft by setting [`MaxOverdraft`](/libraries/dotnet-reference/models/activate-model#max-overdraft-ac4eb42989) to a value greater than 0. |

**Returns:** `bool`. True when a matching activation is present; false otherwise.

**Checks:** Matches activation identifiers. It does not check the signature, expiry, blocking or floating-seat deadline.

Machine binding requires **Maximum Number of Machines greater than 0**. For floating licenses, use `isFloatingLicense=true` and reuse the same process ID for renewals. The overload with an explicit machine code avoids recomputing it. `allowOverdraft` defaults to false.

<a id="is-on-right-machine-pi-143f85bd3c" />

### IsOnRightMachinePI(LicenseKey, bool, bool, int)

Computes a platform-independent machine code and checks it against the license activations.

<CodeGroup>
  ```csharp C# theme={null}
  public static bool IsOnRightMachinePI(LicenseKey licenseKey, bool isFloatingLicense = false, bool allowOverdraft = false, int v = 1)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function IsOnRightMachinePI(licenseKey As LicenseKey, Optional isFloatingLicense As Boolean = False, Optional allowOverdraft As Boolean = False, Optional v As Integer = 1) As Boolean
  ```
</CodeGroup>

**Parameters**

| Name | Type | Description |
| - | - | - |
| `licenseKey` | [`LicenseKey`](/libraries/dotnet-reference/license-key) | The license key object. |
| `isFloatingLicense` | `bool` | If this is a floating license, this parameter has to be set to true.<br />     You can enable floating licenses by setting [`FloatingTimeInterval`](/libraries/dotnet-reference/models/activate-model#floating-time-interval-d289bcb738)<br />     to a value greater than 0. |
| `allowOverdraft` | `bool` | If floating licensing is enabled with overdraft, this parameter should be set to true.<br />     You can enable overdraft by setting [`MaxOverdraft`](/libraries/dotnet-reference/models/activate-model#max-overdraft-ac4eb42989) to a value greater than 0. |
| `v` | `int` | If version is set to 2, you can get the machine code as in the Python client,<br />    assuming similar settings are used. You can read more about it here: <br />    [https://help.cryptolens.io/faq/index#machine-code-generation](https://help.cryptolens.io/faq/index#machine-code-generation) |

**Returns:** `bool`. True for a matching activation; false otherwise.

**Checks:** Matches machine identity only. It does not check the signature, expiry, blocking or floating-seat deadline.

Requires **Maximum Number of Machines greater than 0**. The `v` argument selects the machine-code algorithm and defaults to 1.

<a id="is-successful-c592445e12" />

### IsSuccessful(BasicResult)

Checks an API result for success.

<CodeGroup>
  ```csharp C# theme={null}
  public static bool IsSuccessful(BasicResult result)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function IsSuccessful(result As BasicResult) As Boolean
  ```
</CodeGroup>

**Parameters**

| Name | Type | Description |
| - | - | - |
| `result` | [`BasicResult`](/libraries/dotnet-reference/models/basic-result) | See [`BasicResult`](/libraries/dotnet-reference/models/basic-result). |

**Returns:** `bool`. True when the result is non-null and Result is Success; false otherwise.

**Checks:** This does not verify or validate a returned license.

<a id="is-vm-2bfb63354f" />

### IsVM()

Checks Windows motherboard information for signs of a virtual machine.

<CodeGroup>
  ```csharp C# theme={null}
  [SecuritySafeCritical]
  public static bool IsVM()
  ```

  ```vb VB.NET theme={null}
  <SecuritySafeCritical>
  Public Shared Function IsVM() As Boolean
  ```
</CodeGroup>

**Availability:** Standard package: .NET Framework 3.5, .NET Framework 4.6, .NET Framework 4.7, .NET Framework 4.7.1, .NET Framework 4.8, .NET Standard 2.0.

**Returns:** `bool`. True when the motherboard manufacturer or product matches the built-in virtual-machine checks; otherwise false.

**Failure Behavior:** Windows management queries can throw. This is not a guarantee that every virtual machine will be detected.

<a id="verify-password-eadcf534d2" />

### VerifyPassword(LicenseKey, string, string)

This method verifies the username and password with the information in the LicenseKey object.
It provides a way to activate a license on a per user rather than per machine basis. To compute the password,
the [`ComputePasswordHash(string)`](/libraries/dotnet-reference/methods/helpers#compute-password-hash-02adde39de) is used.
A tutorial on how everything can be set up is available here:
[https://help.cryptolens.io/licensing-models/user-based-activations](https://help.cryptolens.io/licensing-models/user-based-activations)

<CodeGroup>
  ```csharp C# theme={null}
  public static bool VerifyPassword(LicenseKey license, string username, string password)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function VerifyPassword(license As LicenseKey, username As String, password As String) As Boolean
  ```
</CodeGroup>

**Parameters**

| Name | Type | Description |
| - | - | - |
| `license` | [`LicenseKey`](/libraries/dotnet-reference/license-key) | See [`LicenseKey`](/libraries/dotnet-reference/license-key). |
| `username` | `string` | |
| `password` | `string` | |

**Returns:** `bool`. True when the selected activation matches the supplied password hash; otherwise false.

**Checks:** Matches FriendlyName to the username and compares the derived password representation with Mid. It does not verify the license signature.

**Failure Behavior:** Missing activations and some decode failures return false. Malformed salt arrays or Base64 values can throw.

<a id="verify-sdklicense-certificate-9bea128017" />

### VerifySDKLicenseCertificate(string)

Verifies a signed license file and checks that its stored assembly hash matches the application assembly.

<CodeGroup>
  ```csharp C# theme={null}
  public static LicenseKey VerifySDKLicenseCertificate(string RSAPubKey)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function VerifySDKLicenseCertificate(RSAPubKey As String) As LicenseKey
  ```
</CodeGroup>

**Parameters**

| Name | Type | Description |
| - | - | - |
| `RSAPubKey` | `string` | Your RSA Public Key, which can be found here:<br />    [QuickStart](/api-reference/generated/QuickStart) |

**Returns:** [`LicenseKey`](/libraries/dotnet-reference/license-key). License Key object if the certificate is valid and null otherwise.

**Checks:** Loads the companion `.skm` file with the supplied RSA public key, then compares the `cryptolens_assemblyhash` data object's `StringValue` with the assembly's SHA-512 hash. It does not check expiry, blocking or product identity.

**Failure Behavior:** Returns null if loading fails, the data object is missing, or the hashes differ. Missing entry-assembly information or an unreadable assembly file can cause an exception.

<a id="verify-sdklicense-certificate-c2bb888161" />

### VerifySDKLicenseCertificate(string, string, string)

Verifies a signed license file and checks that its stored assembly hash matches the application assembly.

<CodeGroup>
  ```csharp C# theme={null}
  public static LicenseKey VerifySDKLicenseCertificate(string RSAPubKey, string certificate, string path)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function VerifySDKLicenseCertificate(RSAPubKey As String, certificate As String, path As String) As LicenseKey
  ```
</CodeGroup>

**Parameters**

| Name | Type | Description |
| - | - | - |
| `RSAPubKey` | `string` | Your RSA Public Key, which can be found here:<br />    [QuickStart](/api-reference/generated/QuickStart) |
| `certificate` | `string` | The certificate filename without the `.skm` extension. If null, uses the assembly filename. |
| `path` | `string` | The full path of the assembly to check. The certificate must be in the same directory. If null, uses the entry assembly. |

**Returns:** [`LicenseKey`](/libraries/dotnet-reference/license-key). License Key object if the certificate is valid and null otherwise.

**Checks:** Loads the companion `.skm` file with the supplied RSA public key, then compares the `cryptolens_assemblyhash` data object's `StringValue` with the assembly's SHA-512 hash. It does not check expiry, blocking or product identity.

**Failure Behavior:** Returns null if loading fails, the data object is missing, or the hashes differ. Missing entry-assembly information or an unreadable assembly file can cause an exception.

## FAQ

<AccordionGroup>
  <Accordion title="Does a Machine Match Check Floating-Seat Expiry?" id="floating-deadline">
    No. In 4.0.54 these helpers compare the expected machine or process ID with the returned activations. They do not check the floating deadline. Your application must stop licensed work when its last confirmed seat expires. Use the same process ID for renewals, and keep the floating interval consistent across participating processes. See [Floating Licenses](/licensing-models/floating).
  </Accordion>
</AccordionGroup>

[.NET SDK Reference](/libraries/dotnet-api) · [Reviewed Source Revision](https://github.com/Cryptolens/cryptolens-dotnet/tree/30aaf399ba53d9a111bee896c35bf557fa219394)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.