Click or drag to resize

SKMKeyActivation Method

This method will check whether the key is valid or invalid against the Serial Key Manager database. The method will return an object (KeyInformation) only if:
* the key exists in the database (it has been generated)
* the key is not blocked
* the machine code that is activated has not been activated before
* the limit for maximum number of machine codes has not been achieved
* the machine code exists in the Allowed Machine codes.
NOTE: In Addition, depending on the settings, this method will activate a machine code.

Namespace:  SKGL
Assembly:  SKM (in SKM.dll) Version: 4.0.2.6 (4.0.2.6)
Syntax
public static KeyInformation KeyActivation(
	string pid,
	string uid,
	string hsum,
	string sid,
	string mid,
	bool secure = false,
	bool signMid = false,
	bool signPid = false,
	bool signUid = false,
	bool signDate = false
)

Parameters

pid
Type: SystemString
pid
uid
Type: SystemString
uid
hsum
Type: SystemString
hsum
sid
Type: SystemString
Serial Key that is to be validated
mid
Type: SystemString
Machine code
secure (Optional)
Type: SystemBoolean
If true, the key information will contain a signature of itself that you can validate with IsKeyInformationGenuine
signMid (Optional)
Type: SystemBoolean
if set to true, the mid parameter will be included into the signature (requires secure to be true). (Note, secure has to be true, since otherwise machine code (mid) will not be included into the signature.)
signPid (Optional)
Type: SystemBoolean
If true, the Key Information object will contain the Pid field. (Note, secure has to be true, since otherwise Pid will not be included into the signature.)
signUid (Optional)
Type: SystemBoolean
If true, the Key Information object will contain the Uid field. (Note, secure has to be true, since otherwise Uid will not be included into the signature.)
signDate (Optional)
Type: SystemBoolean
If true, the Key Information object will contain the Date field. (when validation was performed). (Note, secure has to be true, since otherwise Date will not be included into the signature.)

Return Value

Type: KeyInformation
Returns a KeyInformation object if all rules were satisfied and null if an error occured.
Remarks
In Debug mode, the error is going to be displayed in the Output Window.
Examples
For pid, uid and hsum, please see https://serialkeymanager.com/Ext/Val. You can also retreive them using GetProductVariables(String, String, String, WebProxy). NB: If trial activation is configured, the API can return a new key (read more at http://support.serialkeymanager.com/kb/trial-activation/).
C#
public void KeyActivation()
{
   var validationResult = SKGL.SKM.KeyActivation("pid", "uid", "hsum", "serial key to validate", "machine code", {sign the data}, {sign machine code});

   if (validationResult != null)
   {
       //valid key
       var created = validationResult.CreationDate;
       var expires = validationResult.ExpirationDate;
       var setTime = validationResult.SetTime;
       var timeLeft = validationResult.TimeLeft;
       var features = validationResult.Features;
   }
   else
   {
       //invalid key
       Assert.Fail();
   }
}
See Also