Click or drag to resize

SKMKeyValidation 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

Namespace:  SKGL
Assembly:  SKM (in SKM.dll) Version: 4.0.2.6 (4.0.2.6)
Syntax
public static KeyInformation KeyValidation(
	string pid,
	string uid,
	string hsum,
	string sid,
	bool secure = 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
secure (Optional)
Type: SystemBoolean
If true, the Key Information will contain a signature of itself that you can validate with IsKeyInformationGenuine
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
KeyInformation or null.
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 retreive them using GetProductVariables(String, String, String, WebProxy).
C#
public void KeyValidation()
{
   var validationResult = SKGL.SKM.KeyValidation("pid", "uid", "hsum", "serial key to validate", "machine code", {sign the data}, {sign machine code});

   if (validationResult.IsValid())
   {
       //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