Show / Hide Table of Contents

    Class LicenseKey

    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.

    Inheritance
    System.Object
    LicenseKey
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: SKM.V3
    Assembly: Cryptolens.Licensing.dll
    Syntax
    public class LicenseKey
    Remarks

    You can use the
    feature lock
    to choose which fields should be masked. On the activation method page, you can use the interactive table to choose which fields should be masked. FieldsToReturn will then get a new value, and this value should then be used in the
    feature lock
    .

    Properties

    ActivatedMachines

    Declaration
    public List<ActivationData> ActivatedMachines { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.List<ActivationData>

    AllowedMachines

    Declaration
    public string AllowedMachines { get; set; }
    Property Value
    Type Description
    System.String

    Block

    Declaration
    public bool Block { get; set; }
    Property Value
    Type Description
    System.Boolean

    Created

    Declaration
    public DateTime Created { get; set; }
    Property Value
    Type Description
    System.DateTime

    Customer

    Declaration
    public Customer Customer { get; set; }
    Property Value
    Type Description
    Customer

    DataObjects

    Declaration
    public List<DataObject> DataObjects { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.List<DataObject>

    Expires

    Declaration
    public DateTime Expires { get; set; }
    Property Value
    Type Description
    System.DateTime

    F1

    Declaration
    public bool F1 { get; set; }
    Property Value
    Type Description
    System.Boolean

    F2

    Declaration
    public bool F2 { get; set; }
    Property Value
    Type Description
    System.Boolean

    F3

    Declaration
    public bool F3 { get; set; }
    Property Value
    Type Description
    System.Boolean

    F4

    Declaration
    public bool F4 { get; set; }
    Property Value
    Type Description
    System.Boolean

    F5

    Declaration
    public bool F5 { get; set; }
    Property Value
    Type Description
    System.Boolean

    F6

    Declaration
    public bool F6 { get; set; }
    Property Value
    Type Description
    System.Boolean

    F7

    Declaration
    public bool F7 { get; set; }
    Property Value
    Type Description
    System.Boolean

    F8

    Declaration
    public bool F8 { get; set; }
    Property Value
    Type Description
    System.Boolean

    GlobalId

    Declaration
    public long GlobalId { get; set; }
    Property Value
    Type Description
    System.Int64

    ID

    Declaration
    public int ID { get; set; }
    Property Value
    Type Description
    System.Int32

    Key

    Declaration
    public string Key { get; set; }
    Property Value
    Type Description
    System.String

    MaxNoOfMachines

    Declaration
    public int MaxNoOfMachines { get; set; }
    Property Value
    Type Description
    System.Int32

    Notes

    Declaration
    public string Notes { get; set; }
    Property Value
    Type Description
    System.String

    Period

    Declaration
    public int Period { get; set; }
    Property Value
    Type Description
    System.Int32

    ProductId

    Declaration
    public int ProductId { get; set; }
    Property Value
    Type Description
    System.Int32

    RawResponse

    Declaration
    public RawResponse RawResponse { get; set; }
    Property Value
    Type Description
    RawResponse

    Reseller

    Declaration
    public Reseller Reseller { get; set; }
    Property Value
    Type Description
    Reseller

    Signature

    Declaration
    public string Signature { get; set; }
    Property Value
    Type Description
    System.String

    SignDate

    Declaration
    public DateTime SignDate { get; set; }
    Property Value
    Type Description
    System.DateTime

    TrialActivation

    Declaration
    public bool TrialActivation { get; set; }
    Property Value
    Type Description
    System.Boolean

    Methods

    AddDataObject(String, DataObject)

    Creates a new DataObject.

    Declaration
    public long AddDataObject(string token, DataObject dataObject)
    Parameters
    Type Name Description
    System.String token

    The access token. Read more at https://app.cryptolens.io/docs/api/v3/Auth

    DataObject dataObject

    The data object to add to the license key.

    Returns
    Type Description
    System.Int64

    Returns the id of the data object (and updates the DataObjects) if successful, or -1 otherwise.

    Remarks

    Note: for more details, please see https://app.cryptolens.io/docs/api/v3/AddDataObject

    AddFeature(String, Int32)

    Gets the new version of this license from SKM. Note, you need to manually assign the new value to this object, eg, by license = license.Refresh("token");

    Declaration
    public bool AddFeature(string token, int feature)
    Parameters
    Type Name Description
    System.String token

    The access token. Read more at https://app.cryptolens.io/docs/api/v3/Auth

    System.Int32 feature

    The feature number, eg. 1,2,...,8.

    Returns
    Type Description
    System.Boolean

    Returns a true if successful and false otherwise.

    Exceptions
    Type Condition
    System.ArgumentException

    If the feature value is incorrect.

    DaysLeft(Boolean)

    Returns the number of days left for a given license (time left). This method is particularly useful when KeyInfo is not updated regularly, because TimeLeft will not be affected (stay constant). If your implementation checks the license with the server periodically, this method should be used instead of TimeLeft.

    Declaration
    public int DaysLeft(bool zeroIfExpired = false)
    Parameters
    Type Name Description
    System.Boolean zeroIfExpired

    If true, when a license has expired, zero will be returned.

    Returns
    Type Description
    System.Int32

    Equals(Object)

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    System.Object obj
    Returns
    Type Description
    System.Boolean
    Overrides
    System.Object.Equals(System.Object)

    FromResponse(String, RawResponse)

    Creates a license key from a RawResponse object that can be obtained when calling .

    Declaration
    public static LicenseKey FromResponse(string RSAPubKey, RawResponse response)
    Parameters
    Type Name Description
    System.String RSAPubKey
    RawResponse response
    Returns
    Type Description
    LicenseKey

    Refresh(String)

    Gets the new version of this license from SKM. By default, if the Signature field ís not null and not empty, SKM will sign the new data too. You can also require this explicitly by calling Refresh(String, Boolean), and setting the second parameter to 'true'.

    Declaration
    public bool Refresh(string token)
    Parameters
    Type Name Description
    System.String token

    The access token. Read more at https://app.cryptolens.io/docs/api/v3/Auth

    Returns
    Type Description
    System.Boolean

    Returns true if successful or false otherwise.

    Remarks

    This method uses GetKeysModel

    Refresh(String, Boolean)

    Gets the new version of this license from SKM.

    Declaration
    public bool Refresh(string token, bool sign)
    Parameters
    Type Name Description
    System.String token

    The access token. Read more at https://app.cryptolens.io/docs/api/v3/Auth

    System.Boolean sign

    If true, SKM will sign the current license key object.

    Returns
    Type Description
    System.Boolean

    Returns true if successful or false otherwise.

    Remarks

    This method uses GetKeysModel

    RemoveDataObject(String, Int32)

    This method will remove an existing data object.

    Declaration
    public bool RemoveDataObject(string token, int dataObjectId)
    Parameters
    Type Name Description
    System.String token

    The access token. Read more at https://app.cryptolens.io/docs/api/v3/Auth

    System.Int32 dataObjectId
    Returns
    Type Description
    System.Boolean

    Returns true if successful or false otherwise.

    Remarks

    Note: for more details, please see https://app.cryptolens.io/docs/api/v3/IncrementIntValue

    Extension Methods

    ExtensionMethods.SaveToFile(LicenseKey)
    ExtensionMethods.SaveToFile(LicenseKey, String)
    ExtensionMethods.SaveAsString(LicenseKey)
    ExtensionMethods.LoadFromString(LicenseKey, String, String)
    ExtensionMethods.LoadFromFile(LicenseKey, String, String)
    ExtensionMethods.IsValid(LicenseKey)
    ExtensionMethods.IsValid(LicenseKey, String)
    ExtensionMethods.HasNotExpired(LicenseKey, Boolean, Boolean)
    ExtensionMethods.HasValidSignature(LicenseKey, String)
    ExtensionMethods.HasValidSignature(LicenseKey, String, Nullable<Int32>)
    ExtensionMethods.HasFeature(LicenseKey, Int32)
    ExtensionMethods.HasNotFeature(LicenseKey, Int32)
    ExtensionMethods.RegisterEvent(LicenseKey, String, Event, String)
    ExtensionMethods.RegisterEvent(LicenseKey, String, Event)
    ExtensionMethods.IsOnRightMachine(LicenseKey, Boolean, Boolean)
    ExtensionMethods.IsOnRightMachine(LicenseKey, String, Boolean, Boolean)
    ExtensionMethods.IsOnRightMachine(LicenseKey, Func<String, String>, Boolean, Boolean)
    ExtensionMethods.IsBlocked(LicenseKey)
    ExtensionMethods.IsNotBlocked(LicenseKey)
    Back to top Copyright © 2018 Cryptolens AB