ArmDotKeyGen.php

ArmDotKeyGen.php is a template of PHP script created to automate generating of license keys. One can use ArmDotKeyGen.php on a web server to create license keys.

The script is installed into ArmDot installation directory, by default ArmDotKeyGen.php is available via the path %ProgramFiles(x86)%\ArmDot\keygens\php\ArmDotKeyGen.php or %ProgramFiles%\ArmDot\keygens\php\ArmDotKeyGen.php.

Usage

As ArmDotKeyGen.php is a template only, one needs to modify it to make it work for your ArmDot project.

Project Information

First, take two parameters, private exponent and modulus, from a project file.

Just open *.armdotproj file in your favourite text editor and find the following at the beginning:

<ArmDotProject>
  <Cryptography Method="RSA" PrivateExponent="kR4IbNzzy1J0HKsbm8CfLJget8p8Kh5XeN6kbVXgnoff8YEFjvvvyxopXGbOBdRKCjM2eFNf2fN+8Ed4RJUuL0UnUa98268qFvxM4I3mnhhIgHi9KCCI6dulJlWCJLCwMpIzAq7GLJhdjhNKwS416YwuPsx3SYioybboudS1ok8A"
   Modulus="wbe+R3ci2f5nc/KhoiNfOprHft9dZF8FlpYoRMmpqSm2CiNq2u2QrS65yGm3b1SnoZb+FqdxrQkKjdxl9yQy7hLVzkcWQRfZ13NybN6ipFfV1MBNX6bDZ7q+J+Ka8dPaFBTha5zsO/lDw5aWeallsXj0Eg90bYgKtq3XLbIbEqwA" />

private exponent and modulus are values of the attributes PrivateExponent and Modulus respectively.

Now let's modify ArmDotKeyGen.php to make it create serial keys for your application. Open it and find $armdot_project, replace values of "privateExponent" and "modulus" with ones from your project.

You should get the following:

// Take these parameters from ArmDot project
$armdot_project = array
(
    "privateExponent" => "kR4IbNzzy1J0HKsbm8CfLJget8p8Kh5XeN6kbVXgnoff8YEFjvvvyxopXGbOBdRKCjM2eFNf2fN+8Ed4RJUuL0UnUa98268qFvxM4I3mnhhIgHi9KCCI6dulJlWCJLCwMpIzAq7GLJhdjhNKwS416YwuPsx3SYioybboudS1ok8A",
    "modulus" => "wbe+R3ci2f5nc/KhoiNfOprHft9dZF8FlpYoRMmpqSm2CiNq2u2QrS65yGm3b1SnoZb+FqdxrQkKjdxl9yQy7hLVzkcWQRfZ13NybN6ipFfV1MBNX6bDZ7q+J+Ka8dPaFBTha5zsO/lDw5aWeallsXj0Eg90bYgKtq3XLbIbEqwA"
);

License Key Information

Above we discussed keygen parameters, now you need to specify license information. The ArmDotKeyGen.php provides a sample:

// Serial key parameters
$registration_information = array
(
    // The string must be in UTF-8
    "registrationName" => "UserName",
 
    // The string must be in UTF-8
    "registrationEMail" => "UserName@domain.com",
 
    // If you don't want to specify expiration date, remove or comment the following line
    "expirationDate" => array("year" => 2018, "month" => 10, "day" => 1), // 1st October 2018
 
    // If you don't want to specify maximum build date, remove or comment the following line
    "maximumBuildDate" => array("year" => 2018, "month" => 10, "day" => 1), // 1st October 2018
 
    // If you don't want to specify user data, remove or comment the following line
    "userData" => base64_decode("VXNlckRhdGE=")
 
    // If you don't want to specify hardware id, remove or comment the following line
    "hardwareId" => base64_decode("B5tSHNWJJ8FJe/md+ouOVFjbYmpk")
);

In most cases, one get parameters from CGI parameters.

Error Handling

Also you might be interested in making your version of the function on_keygen_error that is called when the keygen encounters an error. This is version by default:

// This function is called when the keygen encounters an error
function on_keygen_error($errorDescription)
{
    echo("No license key generated. Please contact vendor for details\n");
 
    // Send an e-mail or write to a database
    //mail("support@yourdomain.com", "Keygen error", $errorDescription);
 
    // Prints error to stderr
    fwrite(STDERR, $errorDescription);
 
    // Exit with error
    exit(-1);
}