Get Demo
  • Windows
  • MacOS
  • Linux

Serial number encryption algorithms

The security of a key in a licensing system is based on asymmetric cryptography algorithms. The current version implements the RSA algorithm with key lengths ranging from 1024 to 16384 bits. Future versions are planned to support other algorithms based on ECC, as well as combined symmetric-asymmetric cryptography.

The algorithm used is unique for each product. Keys generated with one algorithm cannot be used with another, which means changing algorithms after at least one license has been created is not allowed. The protection module in the protected program “knows” which algorithm was used to encrypt the serial number and will not accept keys generated with other algorithms or with the same algorithm but different parameters (for example, a different key length).

RSA Algorithm

A serial number is encrypted with the RSA algorithm as follows:

  • Adding random data to the beginning of the serial number – this method is based on RFC2313, but the implementation is slightly different. The following bytes are added to the beginning of the key: 00 02 NN…NN 00, where NN..NN represents 8 to 16 random non-zero bytes. The number of bytes is random, but the system takes into account the key length and its maximum capacity.
  • Adding random data to the end of the serial number – the total number of bytes in a serial number must be equal to the number of bits in the algorithm’s key divided by 8. The serial number is appended with the corresponding number of bytes containing random data. As a result, the following serial number format is produced: 00 02 NN..NN 00 DD..DD MM..MM, where NN is a set of random non-zero bytes, DD is the original serial number, and MM is a set of random bytes (including zeros). The total length of the sequence must be equal to the number of bits in the algorithm’s key divided by 8.
  • Encryption is performed using a standard procedure implemented in many libraries for handling large numbers. The PHP generator contains all the required information.
  • Packing – the resulting byte sequence after encryption is encoded in Base64 — this is the serial number delivered to the customer.
Last updated 11 days ago