> ## 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.

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

```vb VB.NET theme={null}
Public Class LicenseKey
```

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

## Properties

### ActivatedMachines

Activated devices/machines that belong to this license key.

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

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

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

### AllowedMachines

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

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

```vb VB.NET theme={null}
Public Property AllowedMachines As String
```

**Type:** `string`

### Block

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

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

```vb VB.NET theme={null}
Public Property Block As Boolean
```

**Type:** `bool`

### Created

The creation date of the license key.

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

```vb VB.NET theme={null}
Public Property Created As Date
```

**Type:** `DateTime`

### Customer

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

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

```vb VB.NET theme={null}
Public Property Customer As Customer
```

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

### DataObjects

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

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

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

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

### Expires

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

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

```vb VB.NET theme={null}
Public Property Expires As Date
```

**Type:** `DateTime`

### F1

The feature 1 of the license key.

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

```vb VB.NET theme={null}
Public Property F1 As Boolean
```

**Type:** `bool`

### F2

The feature 2 of the license key.

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

```vb VB.NET theme={null}
Public Property F2 As Boolean
```

**Type:** `bool`

### F3

The feature 3 of the license key.

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

```vb VB.NET theme={null}
Public Property F3 As Boolean
```

**Type:** `bool`

### F4

The feature 4 of the license key.

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

```vb VB.NET theme={null}
Public Property F4 As Boolean
```

**Type:** `bool`

### F5

The feature 5 of the license key.

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

```vb VB.NET theme={null}
Public Property F5 As Boolean
```

**Type:** `bool`

### F6

The feature 6 of the license key.

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

```vb VB.NET theme={null}
Public Property F6 As Boolean
```

**Type:** `bool`

### F7

The feature 7 of the license key.

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

```vb VB.NET theme={null}
Public Property F7 As Boolean
```

**Type:** `bool`

### F8

The feature 8 of the license key.

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

```vb VB.NET theme={null}
Public Property F8 As Boolean
```

**Type:** `bool`

### 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).

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

```vb VB.NET theme={null}
Public Property GlobalId As Long
```

**Type:** `long`

### ID

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

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

```vb VB.NET theme={null}
Public Property ID As Integer
```

**Type:** `int`

### Key

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

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

```vb VB.NET theme={null}
Public Property Key As String
```

**Type:** `string`

### 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.

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

```vb VB.NET theme={null}
Public Property MaxNoOfMachines As Integer
```

**Type:** `int`

### Notes

The notes field of the license key.

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

```vb VB.NET theme={null}
Public Property Notes As String
```

**Type:** `string`

### Period

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

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

```vb VB.NET theme={null}
Public Property Period As Integer
```

**Type:** `int`

### ProductId

The ID of the product that this key belongs to.

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

```vb VB.NET theme={null}
Public Property ProductId As Integer
```

**Type:** `int`

### RawResponse

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

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

```vb VB.NET theme={null}
Public Property RawResponse As RawResponse
```

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

### Reseller

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

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

```vb VB.NET theme={null}
Public Property Reseller As Reseller
```

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

### SignDate

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

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

```vb VB.NET theme={null}
Public Property SignDate As Date
```

**Type:** `DateTime`

### Signature

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

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

```vb VB.NET theme={null}
Public Property Signature As String
```

**Type:** `string`

### TrialActivation

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

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

```vb VB.NET theme={null}
Public Property TrialActivation As Boolean
```

**Type:** `bool`

## Constructors

### LicenseKey()

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

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

```vb VB.NET theme={null}
Public Sub New()
```

## Methods

### AddDataObject(string, DataObject)

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

```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
```

**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)

### AddFeature(string, int)

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

```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
```

**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.

### DaysLeft(bool)

Calculates the number of days until the license expiry date.

```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
```

**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.

### Equals(object)

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

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

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

**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.

### FromResponse(string, RawResponse)

Verifies and decodes a signed RawResponse.

```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
```

**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`.

### Refresh(string)

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

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

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

**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.

### Refresh(string, bool)

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

```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
```

**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.

### RemoveDataObject(string, int)

This method will remove an existing data object.

```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
```

**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

> **Why Are Some Fields Missing After FromResponse?**
>
> 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.

> **Can I Refresh a License and Then Save It?**
>
> 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.

[.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.