-
Notifications
You must be signed in to change notification settings - Fork 1
Offline license file validation
Bryan Böhnke-Avan edited this page May 19, 2026
·
1 revision
The API also allows you to validate license files via the License.cryptolens.php file.
To properly configure this function, please convert the XML-styled public key into PEM format (PKC#1) and save it into the classes/* directory as key.pub (if License(<Cryptolens $cryptolens>, <string $pathToKey>) $pathToKey is set, the path is overwritten by specified one). Currently, only "other languages" formatted license files can be processed by this API client.
You can convert your key on a site like this one here or using this repository
You can then validate a license key like this:
<?php
require_once "/path/to/autoloader.php";
use Cryptolens_PHP_Client\Cryptolens;
use Cryptolens_PHP_Client\License;
$c = new Cryptolens("YOUR_TOKEN", 12345, Cryptolens::CRYPTOLENS_OUTPUT_PHP);
$l = new License($c); // to specify custom key file location other than /classes/key.pub specify the FULL path as License($c, "/var/www/my/public/key.pub")
$fromString = $l->validateLicense("BASE64-ENCODED-STRING", "BASE64-ENCODED-STRING") // licenseKey and signature
$fromFileContent = $l->validateLicenseFromFileContent(file_get_contents("license.skm")); // License file as string
$fromFile = $l->validateLicenseFromFile("license.skm")
if($fromFile){
echo "Signature successfully validated";
} else {
echo "Could not verify signature";
}