> ## 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: LicenseKey

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

This class describes a License Key object. You can use it to verify a license,
store it in a file, or use some of its methods to update it.

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

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

  ```vb VB.NET theme={null}
  Public Class LicenseKey
  ```
</CodeGroup>

[Web API Reference](/api-reference/generated/model/LicenseKey)

## Properties

<a id="activated-machines-944c1256a7" />

### ActivatedMachines

Activated devices/machines that belong to this license key.

<CodeGroup>
  ```csharp C# theme={null}
  public List<ActivationData> ActivatedMachines { get; set; }
  ```

  ```vb VB.NET theme={null}
  Public Property ActivatedMachines As List(Of ActivationData)
  ```
</CodeGroup>

**Type:** `List` of [`ActivationData`](/libraries/dotnet-reference/activation-data)

<a id="allowed-machines-68f26ea8da" />

### AllowedMachines

Machine codes of those devices that will be prioritized during activation. Even if the limit is achieved, these will still be activated.

<CodeGroup>
  ```csharp C# theme={null}
  public string AllowedMachines { get; set; }
  ```

  ```vb VB.NET theme={null}
  Public Property AllowedMachines As String
  ```
</CodeGroup>

**Type:** `string`

<a id="block-b8bfaa9946" />

### Block

Whether this license is blocked. A successful GetKey response can contain a blocked license.

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

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

**Type:** `bool`

<a id="created-b5db2a83e4" />

### Created

The creation date of the license key.

<CodeGroup>
  ```csharp C# theme={null}
  public DateTime Created { get; set; }
  ```

  ```vb VB.NET theme={null}
  Public Property Created As Date
  ```
</CodeGroup>

**Type:** `DateTime`

<a id="customer-22c52c75a2" />

### Customer

The entire [customer](/api-reference/generated/model/Customer) object assigned to this license key.

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

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

**Type:** [`Customer`](/libraries/dotnet-reference/customer)

<a id="data-objects-cc2c604bf8" />

### DataObjects

A list of [Data objects](/api-reference/generated/model/DataObject), additional variables associated with the license key.

<CodeGroup>
  ```csharp C# theme={null}
  public List<DataObject> DataObjects { get; set; }
  ```

  ```vb VB.NET theme={null}
  Public Property DataObjects As List(Of DataObject)
  ```
</CodeGroup>

**Type:** `List` of [`DataObject`](/libraries/dotnet-reference/data-object)

<a id="expires-e973da20ab" />

### Expires

The license expiry date. Enforce it according to your application's licensing policy; API success alone does not check it.

<CodeGroup>
  ```csharp C# theme={null}
  public DateTime Expires { get; set; }
  ```

  ```vb VB.NET theme={null}
  Public Property Expires As Date
  ```
</CodeGroup>

**Type:** `DateTime`

<a id="f1-9d25150216" />

### F1

The feature 1 of the license key.

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

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

**Type:** `bool`

<a id="f2-46a5590b46" />

### F2

The feature 2 of the license key.

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

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

**Type:** `bool`

<a id="f3-c275eba0b4" />

### F3

The feature 3 of the license key.

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

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

**Type:** `bool`

<a id="f4-8b998d4745" />

### F4

The feature 4 of the license key.

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

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

**Type:** `bool`

<a id="f5-9a56c48886" />

### F5

The feature 5 of the license key.

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

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

**Type:** `bool`

<a id="f6-f81ba14fd0" />

### F6

The feature 6 of the license key.

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

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

**Type:** `bool`

<a id="f7-b2f8b58d16" />

### F7

The feature 7 of the license key.

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

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

**Type:** `bool`

<a id="f8-88110558ab" />

### F8

The feature 8 of the license key.

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

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

**Type:** `bool`

<a id="global-id-332d2b5d1b" />

### GlobalId

A unique identifier of the license key. It can, for instance, be used as a "ReferencerId" when creating a [data object(aka additional variables)](/api-reference/generated/DataObjectsIntro).

<CodeGroup>
  ```csharp C# theme={null}
  public long GlobalId { get; set; }
  ```

  ```vb VB.NET theme={null}
  Public Property GlobalId As Long
  ```
</CodeGroup>

**Type:** `long`

<a id="id-2591d9ed81" />

### ID

The ID (within the product) of the license key.

<CodeGroup>
  ```csharp C# theme={null}
  public int ID { get; set; }
  ```

  ```vb VB.NET theme={null}
  Public Property ID As Integer
  ```
</CodeGroup>

**Type:** `int`

<a id="key-c9e0f29a96" />

### Key

The license key string, eg. ABCDE-EFGHI-JKLMO-PQRST.

<CodeGroup>
  ```csharp C# theme={null}
  public string Key { get; set; }
  ```

  ```vb VB.NET theme={null}
  Public Property Key As String
  ```
</CodeGroup>

**Type:** `string`

<a id="max-no-of-machines-cd59740fab" />

### MaxNoOfMachines

The maximum number of machines/devices that may activate this license. By setting this to 0, machine locking will be disabled and an unlimited number of devices will be able to activate the license.

<CodeGroup>
  ```csharp C# theme={null}
  public int MaxNoOfMachines { get; set; }
  ```

  ```vb VB.NET theme={null}
  Public Property MaxNoOfMachines As Integer
  ```
</CodeGroup>

**Type:** `int`

<a id="notes-850fa8e93f" />

### Notes

The notes field of the license key.

<CodeGroup>
  ```csharp C# theme={null}
  public string Notes { get; set; }
  ```

  ```vb VB.NET theme={null}
  Public Property Notes As String
  ```
</CodeGroup>

**Type:** `string`

<a id="period-0df360fb70" />

### Period

The duration of current license cycle eg. 30 days. Note, this is a static number and does not change automatically.

<CodeGroup>
  ```csharp C# theme={null}
  public int Period { get; set; }
  ```

  ```vb VB.NET theme={null}
  Public Property Period As Integer
  ```
</CodeGroup>

**Type:** `int`

<a id="product-id-ecf49795ea" />

### ProductId

The ID of the product that this key belongs to.

<CodeGroup>
  ```csharp C# theme={null}
  public int ProductId { get; set; }
  ```

  ```vb VB.NET theme={null}
  Public Property ProductId As Integer
  ```
</CodeGroup>

**Type:** `int`

<a id="raw-response-53cad4fac8" />

### RawResponse

The original signed RawResponse, when the object was created from that format. SaveAsString preserves this response.

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

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

**Type:** [`RawResponse`](/libraries/dotnet-reference/models/raw-response)

<a id="reseller-2734772753" />

### Reseller

The reseller assigned to the license, when returned. FromResponse does not copy this field in 4.0.54.

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

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

**Type:** [`Reseller`](/libraries/dotnet-reference/reseller)

<a id="sign-date-c2eeb618f0" />

### SignDate

The signed response timestamp. Offline age checks use this time; saving the file again does not update it.

<CodeGroup>
  ```csharp C# theme={null}
  public DateTime SignDate { get; set; }
  ```

  ```vb VB.NET theme={null}
  Public Property SignDate As Date
  ```
</CodeGroup>

**Type:** `DateTime`

<a id="signature-b775eb20e5" />

### Signature

The signature used by the serialized-LicenseKey signing format. For objects created by FromResponse, the signature is held in RawResponse instead.

<CodeGroup>
  ```csharp C# theme={null}
  public string Signature { get; set; }
  ```

  ```vb VB.NET theme={null}
  Public Property Signature As String
  ```
</CodeGroup>

**Type:** `string`

<a id="trial-activation-ff2d5a47d8" />

### TrialActivation

Tells if [trial activation](https://help.cryptolens.io/web-interface/trial-activation) is enabled.

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

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

**Type:** `bool`

## Constructors

<a id="ctor-ce57dee790" />

### LicenseKey()

Creates an empty LicenseKey object. This constructor does not send an API request.

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

  ```vb VB.NET theme={null}
  Public Sub New()
  ```
</CodeGroup>

## Methods

<a id="add-data-object-934b704905" />

### AddDataObject(string, DataObject)

Creates a new [`DataObject`](/libraries/dotnet-reference/data-object).

<CodeGroup>
  ```csharp C# theme={null}
  public long AddDataObject(string token, DataObject dataObject)
  ```

  ```vb VB.NET theme={null}
  Public Function AddDataObject(token As String, dataObject As DataObject) As Long
  ```
</CodeGroup>

**Parameters**

| Name | Type | Description |
| - | - | - |
| `token` | `string` | The access token. Read more at [Auth](/api-reference/generated/Auth) |
| `dataObject` | [`DataObject`](/libraries/dotnet-reference/data-object) | The data object to add to the license key. |

**Returns:** `long`. Returns the id of the data object (and updates the [`DataObjects`](/libraries/dotnet-reference/license-key#data-objects-cc2c604bf8)) if successful, or -1 otherwise.

Note: for more details, please see
[AddDataObject](/api-reference/generated/AddDataObject)

<a id="add-feature-6d613adf44" />

### AddFeature(string, int)

Enables a numbered feature through the API and updates the matching local F1–F8 property.

<CodeGroup>
  ```csharp C# theme={null}
  public bool AddFeature(string token, int feature)
  ```

  ```vb VB.NET theme={null}
  Public Function AddFeature(token As String, feature As Integer) As Boolean
  ```
</CodeGroup>

**Parameters**

| Name | Type | Description |
| - | - | - |
| `token` | `string` | The access token. Read more at [Auth](/api-reference/generated/Auth) |
| `feature` | `int` | The feature number, eg. 1,2,...,8. |

**Returns:** `bool`. True after a successful API result; false otherwise.

**Failure Behavior:** Throws ArgumentException when feature is outside 1 through 8.

The access token needs the **AddFeature permission**. Updating the object does not create a new signed response.

<a id="days-left-f7d2325fc3" />

### DaysLeft(bool)

Calculates the number of days until the license expiry date.

<CodeGroup>
  ```csharp C# theme={null}
  public int DaysLeft(bool zeroIfExpired = false)
  ```

  ```vb VB.NET theme={null}
  Public Function DaysLeft( Optional zeroIfExpired As Boolean = False) As Integer
  ```
</CodeGroup>

**Parameters**

| Name | Type | Description |
| - | - | - |
| `zeroIfExpired` | `bool` | If true, when a license has expired, zero will be returned. |

**Returns:** `int`. Days until Expires, rounded upward. With zeroIfExpired=true, negative values are replaced by zero.

**Checks:** Uses DateTime.UtcNow; does not verify the signature or decide whether the application may run.

<a id="equals-a27f8e8e6d" />

### Equals(object)

Compares this object with another object using this type's equality implementation.

<CodeGroup>
  ```csharp C# theme={null}
  public override bool Equals(object obj)
  ```

  ```vb VB.NET theme={null}
  Public Overrides Function Equals(obj As Object) As Boolean
  ```
</CodeGroup>

**Parameters**

| Name | Type | Description |
| - | - | - |
| `obj` | `object` | The object to compare. |

**Returns:** `bool`. True when the compared fields match; otherwise false. This is not a signature or license-validity check.

**Checks:** This comparison is not signature verification or license validation.

<a id="from-response-654142ab2a" />

### FromResponse(string, RawResponse)

Verifies and decodes a signed RawResponse.

<CodeGroup>
  ```csharp C# theme={null}
  public static LicenseKey FromResponse(string RSAPubKey, RawResponse response)
  ```

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

**Parameters**

| Name | Type | Description |
| - | - | - |
| `RSAPubKey` | `string` | Your account's RSA public key. |
| `response` | [`RawResponse`](/libraries/dotnet-reference/models/raw-response) | The API response to verify and decode. |

**Returns:** [`LicenseKey`](/libraries/dotnet-reference/license-key). A new `LicenseKey` with its `RawResponse` attached. Returns null for a null/error response or failed RSA signature verification.

**Checks:** Verifies the license payload signature using the supplied RSA public key. It does not enforce expiry, blocking, machine binding, features or cache age, and does not verify metadata.

**Failure Behavior:** Malformed Base64 or decoded license JSON can throw; those conversions are outside the signature-verification catch.

In 4.0.54, this conversion does not copy `Reseller`, `ActivationData.FriendlyName` or `ActivationData.FloatingExpires` into the parsed license. The original signed response remains in `RawResponse`.

<a id="refresh-8496690d5b" />

### Refresh(string)

Retrieves updated license data using GetKey and copies fields into this object.

<CodeGroup>
  ```csharp C# theme={null}
  public bool Refresh(string token)
  ```

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

**Parameters**

| Name | Type | Description |
| - | - | - |
| `token` | `string` | The access token. Read more at [Auth](/api-reference/generated/Auth) |

**Returns:** `bool`. True when GetKey succeeds and the fields are updated; false for a failed result.

**Checks:** Does not verify the new signature and does not renew a floating seat.

The access token needs the **GetKey permission**. The overload without `sign` requests signing only when the existing `Signature` string is non-empty. In 4.0.54, Refresh does not replace an attached `RawResponse`; load a freshly verified response instead when using that format.

<a id="refresh-c023ca6c5d" />

### Refresh(string, bool)

Retrieves updated license data using GetKey and copies fields into this object.

<CodeGroup>
  ```csharp C# theme={null}
  public bool Refresh(string token, bool sign)
  ```

  ```vb VB.NET theme={null}
  Public Function Refresh(token As String, sign As Boolean) As Boolean
  ```
</CodeGroup>

**Parameters**

| Name | Type | Description |
| - | - | - |
| `token` | `string` | The access token. Read more at [Auth](/api-reference/generated/Auth) |
| `sign` | `bool` | If true, SKM will sign the current license key object. |

**Returns:** `bool`. True when GetKey succeeds and the fields are updated; false for a failed result.

**Checks:** Does not verify the new signature and does not renew a floating seat.

The access token needs the **GetKey permission**. The overload without `sign` requests signing only when the existing `Signature` string is non-empty. In 4.0.54, Refresh does not replace an attached `RawResponse`; load a freshly verified response instead when using that format.

<a id="remove-data-object-4ca4bf2ff8" />

### RemoveDataObject(string, int)

This method will remove an existing data object.

<CodeGroup>
  ```csharp C# theme={null}
  public bool RemoveDataObject(string token, int dataObjectId)
  ```

  ```vb VB.NET theme={null}
  Public Function RemoveDataObject(token As String, dataObjectId As Integer) As Boolean
  ```
</CodeGroup>

**Parameters**

| Name | Type | Description |
| - | - | - |
| `token` | `string` | The access token. Read more at [Auth](/api-reference/generated/Auth) |
| `dataObjectId` | `int` | |

**Returns:** `bool`. Returns true if successful or false otherwise.

Uses the RemoveDataObject API for this license. The access token needs the **RemoveDataObject permission**; a successful call also updates the local DataObjects list.

## FAQ

<AccordionGroup>
  <Accordion title="Why Are Some Fields Missing After FromResponse?" id="conversion-fields">
    In 4.0.54, `FromResponse` does not copy `Reseller`, `ActivatedMachines[].FriendlyName` or `ActivatedMachines[].FloatingExpires` into the resulting object. The original response remains in `RawResponse`. Do not assume these fields are absent on the server because the converted object has no value.
  </Accordion>

  <Accordion title="Can I Refresh a License and Then Save It?" id="refresh-and-save">
    Be careful with objects created by `FromResponse`: `Refresh` changes the object's fields but does not replace its stored `RawResponse`. `SaveAsString` prefers that stored response, so it can save the older data. Retrieve a new signed response, verify it and save the newly returned object instead.
  </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.