CGI Key Generator
CGI Key Generator can be used for generating registration keys for certain projects through the remote server call, web page, web request. CGI key generator should be placed on the server (there are 2 kinds of CGI key generators, for Windows and for Linux servers, you can find it in EnigmaSDK\CGI Keygen folder) into the cgi-bin folder, and the execution attributes (permissions) for the key generator file should be enabled. Calling the CGI generator with the necessary parameters will generate a registraton key. The key generator parameters could be passed to the CGI key generator by GET or POST method. Remote CGI key generator is the best way to integrate a key generator with automatic registrators like ShareIt, RegNow, Plimus etc.
How to use the CGI key generator:
1. Place the keygen to the cgi-bin folder of your web site (make sure that your server supports execution of CGI applications)
2. Enable execution permissions for the keygen file ("keygen" for Linux and "keygen.exe" for Windows servers)
3. Create a link for key generator execution:
There are the following actions that could be used with CGI key generator:
- GenerateKey - generates ANSI* registration keys;
- GenerateKeyA - the duplicate of GenerateKey;
- GenerateKeyW - generates unicode* (wide string) registration keys;
- GenerateKeyFromProject - generates registration keys based on a settings in the project file, generator parameters** will be extracted from the project file;
* please note that you should only use ANSI or unicode scheme of licensing for a particular project. If the UNICODE Registration Scheme option is enabled in the REGISTRATION FEATURE - Common panel, the key generator should be called with a unicode support action (actions with W prefix), otherwise ANSI actions should be used.
** generator parameters - is registration scheme unicode or no, KeyMode, KeyBase, EncryptedConstant, PublicKey, PrivateKey.
CGI Key Generator accepts the following parameters:
Action - defines the action to be performed, allows the following values:
- GenerateKey
- GenerateKeyA
- GenerateKeyW
- GenerateKeyFromProject
FileName - the name of the project file. This parameter is used only for actions that use the project file (like GenerateKeyFromProject). String should be UTF-8 encoded;
RegName - enter a registration name for the registration key. Please note that this string should be http encoded to avoid appearing of untranslated symbols (for example, the space symbol should be translated into %20 but not " ") and the source string should be in UFT-8 encoding;
KeyMode - defines what type of registration key should be generated. To get this value, open your project file in Enigma and go to REGISTRATION FEATURES-Common panel, take a look at the Registration key safety/length field, for example, if this field is RSA 1024, you should use KeyMode=1024 (possible values for KeyMode are 512/768/1024/2048/3072/4096);
KeyBase - defines the output format of a registration key. To get this value, open your project file in Enigma and go to REGISTRATION FEATURES-Common panel, take a look at the Registration key output base field, for example, if this field is Base 32, then you should use KeyBase=32 (possible values for KeyBase are 2/8/16/32/64);
Hyphens - indicates if the registration key should be divided my hyphens or not. If yes, enter Hyphens=1, otherwise skip this parameter;
Hardware - the hardware ID the registration key should be locked to;
Expiration - the registration key expiration date, define this parameter with the expiration date value*;
RegAfter - Register After date*;
RegBefore - Register Before date*;
Executions - the number of executions to limit the registration key to;
Days - the number of days to limit the registration key to;
Runtime - the number of run-time minutes to limit the registration key to;
Globaltime - the overall number of minutes to limit the registration key to;
Country - the code of the county to lock the registration key to;
Sections - if the registration key should unlock crypted sections, generate a 16-digit string indicating the section that should be unlocked with the generated key. If digit = 1, the key will unlock a section, or 0 if no section should be unlocked. The section string 1010001001001001 shows that sections #1, #3, #7, #10, #13, #16 should be unlocked
EncryptedConstant - get this constant from the project file, open project file in notepad and find there EnigmaProject-RegistrationFeatures-Constants-EncryptedConstant branch and get its value
PrivateKey and PublicKey - values should be looked up in the project file. To get these values, open your project file in Enigma and go to the REGISTRATION FEATURES - Common panel, the Public and Private Keys are shown in the "Information for Custom Keys Generator" box.
* the date value should be represented in a string. The date has the following format: 2 digits (day) + 2 digits (month) + 4 digits (year). For example, 1 Dec 2010 date is string 01122010
Examples
Show/Hide PHP (POST using CURL method) example
<?php
function generate_key_post($url, $data)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo('Unable to open remote keys generator');
}
curl_close($ch);
return $response;
}
$data['Action'] = 'GenerateKey';
$data['KeyMode'] = 512;
$data['KeyBase'] = 32;
$data['Hyphens'] = 1;
$data['EncryptedConstant'] = 2113444489;
$data['PrivateKey'] = '00C98B2SF9UBJA605AJX53GJFXJV8UH4A6PY2L6CV4MAMV7V3ERRVY99Y72V2P77Z2J3KBPGWR3WXKG5GF9Z6CKXJHY5VUMBTQ66H2MRZPCU00DLFJ675JTTTNEK00DLFJ675JTTTNEK';
$data['PublicKey'] = '0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5ACP7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQCWCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYHCBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTPSRGDQ742B4742XF4MACRR747YDP5FZZ9D';
$data['RegName'] = 'Vladimir Sukhov';
$regkey = generate_key_post('http://yoursite.com/cgi-bin/keygen', $data);
echo('Registration name: Vladimir Sukhov<br/>Registration Key: '.$regkey);
?>
Show/Hide PHP (POST method) example
<?php
if (!function_exists('http_build_query')) {
function http_build_query($data, $prefix='', $sep='', $key='') {
$ret = array();
foreach ((array)$data as $k => $v) {
if (is_int($k) && $prefix != null) {
$k = urlencode($prefix . $k);
}
if ((!empty($key)) || ($key === 0)) $k = $key.'['.urlencode($k).']';
if (is_array($v) || is_object($v)) {
array_push($ret, http_build_query($v, '', $sep, $k));
} else {
array_push($ret, $k.'='.urlencode($v));
}
}
if (empty($sep)) $sep = ini_get('arg_separator.output');
return implode($sep, $ret);
}
}
function do_post_request($url, $data, $optional_headers = null)
{
$params = array('http' => array(
'method' => 'POST',
'content' => $data
));
if ($optional_headers !== null) {
$params['http']['header'] = $optional_headers;
}
$ctx = stream_context_create($params);
$fp = @fopen($url, 'rb', false, $ctx);
if (!$fp) {
throw new Exception("Problem with $url, $php_errormsg");
}
$response = @stream_get_contents($fp);
if ($response === false) {
throw new Exception("Problem reading data from $url, $php_errormsg");
}
return $response;
}
function generate_key_post($url, $data) {
return do_post_request($url, http_build_query($data));
}
$data['Action'] = 'GenerateKey';
$data['KeyMode'] = 512;
$data['KeyBase'] = 32;
$data['Hyphens'] = 1;
$data['EncryptedConstant'] = 2113444489;
$data['PrivateKey'] = '00C98B2SF9UBJA605AJX53GJFXJV8UH4A6PY2L6CV4MAMV7V3ERRVY99Y72V2P77Z2J3KBPGWR3WXKG5GF9Z6CKXJHY5VUMBTQ66H2MRZPCU00DLFJ675JTTTNEK00DLFJ675JTTTNEK';
$data['PublicKey'] = '0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5ACP7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQCWCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYHCBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTPSRGDQ742B4742XF4MACRR747YDP5FZZ9D';
$data['RegName'] = 'Vladimir Sukhov';
$regkey = generate_key_post('http://yoursite.com/cgi-bin/keygen', $data);
echo('Registration name: Vladimir Sukhov<br/>Registration Key: '.$regkey);
?>
Show/Hide PHP (GET method) example
<?php
function generate_key_get($url) {
$file = fopen ($url, "rb");
if (!$file) {
echo('Unable to open remote file.');
exit;
}
while (!feof ($file)) {
$regkey .= fgets ($file, 2048);
}
fclose($file);
return $regkey;
}
$regkey = generate_key_get('http://yoursite.com/cgi-bin/keygen?Action=GenerateKey&RegName=Vladimir%20Sukhov&KeyMode=512&KeyBase=32&Hyphens=1&Hardware=C69A93-08A25D-D58B73-43CEBD&Expiration=01012030&Sections=1010001001001001&EncryptedConstant=2113444489&PrivateKey=00C98B2SF9UBJA605AJX53GJFXJV8UH4A6PY2L6CV4MAMV7V3ERRVY99Y72V2P77Z2J3KBPGWR3WXKG5GF9Z6CKXJHY5VUMBTQ66H2MRZPCU00DLFJ675JTTTNEK00DLFJ675JTTTNEK&PublicKey=0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5ACP7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQCWCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYHCBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTPSRGDQ742B4742XF4MACRR747YDP5FZZ9D');
echo('Registration name: Vladimir Sukhov<br/>Registration Key: '.$regkey);
?>
Show/Hide HTML (GET method) example
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<body>
<a href="http://yoursite.com/cgi-bin/keygen?Action=GenerateKey&RegName=Vladimir%20Sukhov&KeyMode=512&KeyBase=32&Hyphens=1&Hardware=C69A93-08A25D-D58B73-43CEBD&Expiration=01012030&Sections=1010001001001001&EncryptedConstant=2113444489&PrivateKey=00C98B2SF9UBJA605AJX53GJFXJV8UH4A6PY2L6CV4MAMV7V3ERRVY99Y72V2P77Z2J3KBPGWR3WXKG5GF9Z6CKXJHY5VUMBTQ66H2MRZPCU00DLFJ675JTTTNEK00DLFJ675JTTTNEK&PublicKey=0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5ACP7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQCWCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYHCBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTPSRGDQ742B4742XF4MACRR747YDP5FZZ9D">Click here to generate registration key</a>
</body></html>
Show/Hide HTML (GET method) getting parameters from project file example
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<body>
<a href="http://yoursite.com/cgi-bin/keygen?Action=GenerateKeyFromProject&FileName=default.enigma&RegName=Vladimir%20Sukhov&Hyphens=1&Expiration=01012030&Sections=1010001001001001">Click here to generate registration key from project file</a>
</body></html>
Show/Hide HTML (POST method) example
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<body>
<h1>Registration Keys Generator! POST method </h1>
<form name="frmKeygen" method="POST" action="http://yoursite.com/cgi-bin/keygen">
<input type="hidden" value="GenerateKey" name="Action">
<input type="hidden" value="512" name="KeyMode">
<input type="hidden" value="32" name="KeyBase">
<input type="hidden" value="1" name="Hyphens">
<input type="hidden" value="2113444489" name="EncryptedConstant">
<input type="hidden" value="00C98B2SF9UBJA605AJX53GJFXJV8UH4A6PY2L6CV4MAMV7V3ERRVY99Y72V2P77Z2J3KBPGWR3WXKG5GF9Z6CKXJHY5VUMBTQ66H2MRZPCU00DLFJ675JTTTNEK00DLFJ675JTTTNEK" name="PrivateKey">
<input type="hidden" value="0201B810DA4A1ADD4351378790A98138533067CP4S86R7D8THS45GBCVUM635EPRQRMYRP3DAA5DUPZ6ABDSFP7F5ACP7ERGH4A7Y6B6NW6NMMBZF83WVER9Y4MMBNLBQDKR7KFVLGLV067CFDQCWCHGQVVRN24DECEPBL96YJQJTVDCRTNQG3E4WW4GK4GQ5X5L5H88D3XYHCBRBNASPD3P5CNYFKFHBCSDHHD6WPTCC4XVSM5S88067C2JSTCMVT48C8HC7SHKGTFJBM28P6XTBCNWHMV6J6KN6W5Q9TQLVR285U6GVCAAUTZLRTPSRGDQ742B4742XF4MACRR747YDP5FZZ9D" name="PublicKey">
<table>
<tr>
<td>Enter the Registration Name
</td>
<td>
<input class="textbox" type="text" value="Vladimir Sukhov" name="RegName" />
</td>
</tr>
<tr>
<td>Enter Hardware ID
</td>
<td>
<input class="textbox" type="text" value="C69A93-08A25D-D58B73-43CEBD" name="Hardware" />
</td>
</tr>
<tr>
<td>Enter Expiration Date
</td>
<td>
<input class="textbox" type="text" value="01012030" name="Expiration" />
</td>
</tr>
<tr>
<td>Enter Unlock Section
</td>
<td>
<input class="textbox" type="text" value="1010001001001001" name="Sections" />
</td>
</tr>
</table>
<input type="submit" value="Generate" name="Generate">
</form>
</body></html>
Show/Hide HTML (POST method) getting parameters from project file example
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<body>
<h1>Registration Keys Generator! POST method </h1>
<form name="frmKeygen" method="POST" action="http://yoursite.com/cgi-bin/keygen">
<input type="hidden" value="GenerateKey" name="Action">
<input type="hidden" value="project.enigma" name="FileName">
<input type="hidden" value="1" name="Hyphens">
<table>
<tr>
<td>Enter the Registration Name
</td>
<td>
<input class="textbox" type="text" value="Vladimir Sukhov" name="RegName" />
</td>
</tr>
<tr>
<td>Enter Hardware ID
</td>
<td>
<input class="textbox" type="text" value="C69A93-08A25D-D58B73-43CEBD" name="Hardware" />
</td>
</tr>
<tr>
<td>Enter Expiration Date
</td>
<td>
<input class="textbox" type="text" value="01012030" name="Expiration" />
</td>
</tr>
<tr>
<td>Enter Unlock Section
</td>
<td>
<input class="textbox" type="text" value="1010001001001001" name="Sections" />
</td>
</tr>
</table>
<input type="submit" value="Generate" name="Generate">
</form>
</body></html>
We recommend using the POST method to pass data to the key generator, because the GET method has a data size limit that can be passed through the url string.