Sample PHP code that responds to a license request

$compID = null;
if ( isset($_POST['COMP_ID']) ) $compID = $_POST['COMP_ID']; // you may not receive this parameter if your license type is not Computer Specific
$ID = $_POST['ID'];  // this is the license ID that user entered into the Registration dialog.

// Step 1 - Find the license with the specified ID in your database.

// Step 2 [IMPORTANT] - Decide if the license request is legit
// make sure the license ID sent by the user (ID post value) is in your users database and only then continue generating a license for it
if ( < invalid license request ... > ){
  die('Invalid license ID.');

// Step 3 - Computing the license digital signature

// if present, add extra license elements like MP and EXP maintaining the alphabetical order
$data = '';
if ( $compID ) $data .= 'COMP_ID='.$compID;

$data .= 'ID='.$ID;

//$data is now like '';

$data = mb_convert_encoding($data, "UTF-16LE");

// load the private key. You should obtain this key by exporting from the
// Licensing > Registration page, by using the "Export PEM" Public - Private key pair action.
// You must take safety measures to protect this key (like protecting it with a password) before you upload it to your server.
$pkeyid = openssl_pkey_get_private(file_get_contents("./licenseKey.pem"), "pass");
if ( empty($pkeyid) ) {
  die("Keys generator setup failed");

// compute signature
if ( !openssl_sign($data, $signature, $pkeyid, OPENSSL_ALGO_SHA1) ) {
  die("Failed to generate license");

// free the key from memory

// Step 4 - Respond with the license elements

// Send back the license elements. COMP_ID element may be ommited.
// - license elements separated by ;
// - the element and its value separated by =
// like: ID=john;SIGN=QeDQqqhp6zVB2I5fnu5AgndUMVXj9uD5UEX7vvENr6VLFoPEOsaO70fIIUX572dr
echo 'ID='.$ID.';';

// if your license has a Maintainance Plan element (or any other elements) send them
//echo 'MP='.$MP.';';

echo 'SIGN=', base64_encode($signature);