Search Results for

    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
    object
    LicenseKey
    Inherited Members
    object.ToString()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: SKM.V3
    Assembly: Cryptolens.Licensing.CrossPlatform.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

    | Edit this page View Source

    ActivatedMachines

    Declaration
    public List<ActivationData> ActivatedMachines { get; set; }
    Property Value
    Type Description
    List<ActivationData>
    | Edit this page View Source

    AllowedMachines

    Declaration
    public string AllowedMachines { get; set; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    Block

    Declaration
    public bool Block { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    Created

    Declaration
    public DateTime Created { get; set; }
    Property Value
    Type Description
    DateTime
    | Edit this page View Source

    Customer

    Declaration
    public Customer Customer { get; set; }
    Property Value
    Type Description
    Customer
    | Edit this page View Source

    DataObjects

    Declaration
    public List<DataObject> DataObjects { get; set; }
    Property Value
    Type Description
    List<DataObject>
    | Edit this page View Source

    Expires

    Declaration
    public DateTime Expires { get; set; }
    Property Value
    Type Description
    DateTime
    | Edit this page View Source

    F1

    Declaration
    public bool F1 { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    F2

    Declaration
    public bool F2 { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    F3

    Declaration
    public bool F3 { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    F4

    Declaration
    public bool F4 { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    F5

    Declaration
    public bool F5 { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    F6

    Declaration
    public bool F6 { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    F7

    Declaration
    public bool F7 { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    F8

    Declaration
    public bool F8 { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    GlobalId

    Declaration
    public long GlobalId { get; set; }
    Property Value
    Type Description
    long
    | Edit this page View Source

    ID

    Declaration
    public int ID { get; set; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    Key

    Declaration
    public string Key { get; set; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    MaxNoOfMachines

    Declaration
    public int MaxNoOfMachines { get; set; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    Notes

    Declaration
    public string Notes { get; set; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    Period

    Declaration
    public int Period { get; set; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    ProductId

    Declaration
    public int ProductId { get; set; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    RawResponse

    Declaration
    public RawResponse RawResponse { get; set; }
    Property Value
    Type Description
    RawResponse
    | Edit this page View Source

    Reseller

    Declaration
    public Reseller Reseller { get; set; }
    Property Value
    Type Description
    Reseller
    | Edit this page View Source

    SignDate

    Declaration
    public DateTime SignDate { get; set; }
    Property Value
    Type Description
    DateTime
    | Edit this page View Source

    Signature

    Declaration
    public string Signature { get; set; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    TrialActivation

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

    Methods

    | Edit this page View Source

    AddDataObject(string, DataObject)

    Creates a new DataObject.

    Declaration
    public long AddDataObject(string token, DataObject dataObject)
    Parameters
    Type Name Description
    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
    long

    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

    | Edit this page View Source

    AddFeature(string, int)

    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
    string token

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

    int feature

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

    Returns
    Type Description
    bool

    Returns a true if successful and false otherwise.

    Exceptions
    Type Condition
    ArgumentException

    If the feature value is incorrect.

    | Edit this page View Source

    DaysLeft(bool)

    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
    bool zeroIfExpired

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

    Returns
    Type Description
    int
    | Edit this page View Source

    Equals(object)

    Determines whether the specified object is equal to the current object.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj

    The object to compare with the current object.

    Returns
    Type Description
    bool

    true if the specified object is equal to the current object; otherwise, false.

    Overrides
    object.Equals(object)
    | Edit this page View Source

    FromResponse(string, RawResponse)

    Creates a license key from a RawResponse object that can be obtained when calling Key.Activate(string, int, string, string, bool, int, int).

    Declaration
    public static LicenseKey FromResponse(string RSAPubKey, RawResponse response)
    Parameters
    Type Name Description
    string RSAPubKey
    RawResponse response
    Returns
    Type Description
    LicenseKey
    | Edit this page View Source

    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, bool), and setting the second parameter to 'true'.

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

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

    Returns
    Type Description
    bool

    Returns true if successful or false otherwise.

    Remarks

    This method uses GetKeysModel

    | Edit this page View Source

    Refresh(string, bool)

    Gets the new version of this license from SKM.

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

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

    bool sign

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

    Returns
    Type Description
    bool

    Returns true if successful or false otherwise.

    Remarks

    This method uses GetKeysModel

    | Edit this page View Source

    RemoveDataObject(string, int)

    This method will remove an existing data object.

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

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

    int dataObjectId
    Returns
    Type Description
    bool

    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.HasFeature(LicenseKey, int)
    ExtensionMethods.HasNotExpired(LicenseKey, bool, bool)
    ExtensionMethods.HasNotFeature(LicenseKey, int)
    ExtensionMethods.HasValidSignature(LicenseKey, string)
    ExtensionMethods.HasValidSignature(LicenseKey, string, int?)
    ExtensionMethods.IsBlocked(LicenseKey)
    ExtensionMethods.IsNotBlocked(LicenseKey)
    ExtensionMethods.IsOnRightMachine(LicenseKey, bool, bool)
    ExtensionMethods.IsOnRightMachine(LicenseKey, Func<string, string>, bool, bool)
    ExtensionMethods.IsOnRightMachine(LicenseKey, string, bool, bool)
    ExtensionMethods.IsValid(LicenseKey)
    ExtensionMethods.IsValid(LicenseKey, string)
    ExtensionMethods.LoadFromFile(LicenseKey, string, string)
    ExtensionMethods.LoadFromString(LicenseKey, string, string)
    ExtensionMethods.RegisterEvent(LicenseKey, string, Event)
    ExtensionMethods.RegisterEvent(LicenseKey, string, Event, string)
    ExtensionMethods.SaveAsString(LicenseKey)
    ExtensionMethods.SaveToFile(LicenseKey)
    ExtensionMethods.SaveToFile(LicenseKey, string)
    • Edit this page
    • View Source
    In this article
    Back to top Copyright © Cryptolens AB