enumEBundleUnlockStatus
{
/// @brief Success.///
eOk = 0,
/// @brief Generic error.///
eErrGeneric,
/// @brief License format is invalid.///
eErrInvalidFormat,
/// @brief Checksum calculation is invalid.////// *** Superseded, kept so that existing code that names it still compiles./// The v1 format authenticated licenses with a keyed checksum whose key/// shipped inside the client library, so anyone holding the library/// could mint licenses. Signature failures now report/// @ref eErrInvalidSignature.///
eErrInvalidChecksum,
/// @brief Product UID is not valid for the entered license.///
eErrInvalidProduct,
/// @brief The license has expired.///
eErrExpired,
/// @brief The current version is not compatible with the license version.////// *** Superseded, kept so that existing code that names it still compiles./// Since format v3 a license carries the end of its support, and a/// build released after it reports @ref eErrSupportEnded.///
eErrBuildTooNew,
/// @brief The signature does not belong to this product's issuer.////// *** This is the authenticity check. The other statuses are policy./// A license that fails here was not issued by us: it was forged,/// corrupted in transit, or signed with a different key pair than/// the one this build carries.///
eErrInvalidSignature,
/// @brief The license was produced by a newer format than this build understands.////// *** The format version is the first byte of the payload, and it is/// checked before anything else is interpreted. A build that guessed/// a layout it does not know could reject valid licenses or accept/// malformed ones.///
eErrUnsupportedFormat,
/// @brief This build carries no issuer public key, so it cannot validate anything.////// *** The library was built without a real key configured. It is a/// build mistake, not a customer mistake, and it is reported instead/// of silently unlocking.///
eErrNoPublicKey,
/// @brief The serial is in the blocklist compiled into this build.////// *** A leaked license. Every build released after the block refuses/// it, whatever its support period. Builds released before keep/// accepting it: that is the limit of an offline check.///
eErrRevoked,
/// @brief This build was released after the support of the license ended.////// *** The license is perpetual and still works with every build/// released up to the end of its support. Use one of those, or/// renew the support.///
eErrSupportEnded
};
structSBundleInfo
{
/// @brief Legacy: the type of format v2. Filled from the edition, as/// eBundle0101_Standard or eBundle0101_Full. Read @ref eEdition.EBundleTypes eType;
/// @brief Product identifier the license was issued for.ETL_UINT32 uProductId;
/// @brief Legacy: the minimum build of format v2. Always zero. Read/// @ref uSupportEndDays.ETL_UINT32 uBuildMin;
/// @brief Legacy: same as @ref uValidUntilDays.ETL_UINT32 uExpirationDays;
/// @brief Issue date, in days since 1970-01-01.ETL_UINT32 uIssuedDays;
/// @brief Legacy: the low 32 bits of @ref uSerial64.ETL_UINT32 uSerial;
/// @brief Tag binding the license to a licensee, or zero when unbound.////// *** First eight bytes of the SHA-256 of the licensee name, as typed at/// issue time. It is a tag, not a secret: it does not hide the name and/// does not enforce anything. It lets a key found in the wild be traced/// back to the licensee it was sold to.///ETL_UINT64 uLicenseeTag;
/// @brief Edition: Standard, or Full with the UI components.EBundleEdition eEdition;
/// @brief True for a provisional license, issued at payment and replaced by/// the definitive one when the refund window closes.bool bProvisional;
/// @brief Last valid day, in days since 1970-01-01. Zero means no validity:/// the license never expires.ETL_UINT32 uValidUntilDays;
/// @brief End of support, in days since 1970-01-01: the last release day this/// license covers. Builds released up to it work forever.ETL_UINT32 uSupportEndDays;
/// @brief Release day of this build, in days since 1970-01-01.ETL_UINT32 uReleaseDays;
/// @brief Serial number of this license. Unique per issuance.////// *** Identifies a leaked key. Two customers reporting the same serial/// means the same key in two places.///ETL_UINT64 uSerial64;
};
Read-only view of the license currently unlocked.
Filled by QueryBundle after a successful UnlockBundle. Lets the host application adapt to what was bought (whether the UI components are included, when support lapses) without parsing the serial itself.
The first six fields are the ones of format v2 and are kept so that existing code still compiles. Read the fields after them.
enumELicenseState
{
/// @brief A license was accepted. Every module runs.///
eStateLicensed = 0,
/// @brief No license was passed, and the evaluation of this machine is still/// running. Every module runs, Standard edition.///
eStateEvaluation,
/// @brief No license was passed, and the evaluation of this machine has ended./// The modules refuse with their 'eNotLicensed' value.///
eStateEvaluationEnded,
/// @brief A license was passed and refused. The modules refuse with their/// 'eNotLicensed' value, even while the evaluation would still run:/// an application that passes a license meant to run licensed.///
eStateLicenseRefused
};
structSLicenseState
{
/// @brief The state.ELicenseState eState;
/// @brief Days left in the evaluation, counting today. Zero outside it.ETL_UINT32 uEvaluationDaysLeft;
/// @brief Why the last license passed was refused. @ref eOk when none was.EBundleUnlockStatus eLastRefusal;
};
Never fails. Outside a license, it resolves the evaluation of this machine the first time it is needed, which reads and writes its records once per process.
Unlocks the Ethereal Bundle/Components. Must be executed only once per application.
*** Call this function before interacting with any other Ethereal modules or functions.
*** This is the only way a license reaches the library. It is never read from a file or from the environment: the application passes it here. An application that ships without this call runs on the evaluation of each machine, and stops working when it ends.
Licenses are signed with Ed25519. This library carries only the issuer's public key, which validates a license and cannot produce one. There is no secret in here that a customer could extract to mint keys.
*** The serial is long.
A signature is 64 bytes and cannot be shortened, so the key has 160 characters instead of the 24 of the old format. A key short enough to read aloud would be short enough to forge. Paste it or load it from a file instead of typing it.
Dashes, spaces and letter case are ignored on input, and the letters I, L and O are accepted in place of 1, 1 and 0, so a key read out loud over a phone still works.
BundleSerial
Bundle serial key used for activation.
Unlock result status code.
bundle.h
#include <ethereal/c/bundle/bundle.h>
C layer of the Bundle module.
Unlocks the package license and reads it back. The semantics are the ones of 'ethereal/cpp/bundle/bundle.hpp': read there how the serial is checked.
Every export returns 'int'. Zero is success, negative is an error. The values are part of the ABI: never reordered, never reused, only appended at the end.
Unlocking latches. After the first success, ETLC_BundleUnlock returns ETLC_BUNDLE_OK for the rest of the process, whatever it receives. Call it once, at startup.
What does not cross: issuing and decoding licenses. They need the private key and the internal format, and live in the 'ethereal_license' tool.
typedefstructETLC_BundleInfo
{
/// @brief 'sizeof( ETLC_BundleInfo )'. Smaller than 40 is refused.ETL_UINT32 iStructSize;
/// @brief Legacy: ETLC_BUNDLE_TYPE_0101_STANDARD or _0101_FULL, from/// the edition. Read 'uEdition'.ETL_UINT32 uType;
/// @brief Product identifier the license was issued for.ETL_UINT32 uProductId;
/// @brief Legacy: always zero. Read 'uSupportEndDays'.ETL_UINT32 uBuildMin;
/// @brief Legacy: same as 'uValidUntilDays'.ETL_UINT32 uExpirationDays;
/// @brief Issue date, in days since 1970-01-01.ETL_UINT32 uIssuedDays;
/// @brief Legacy: the low 32 bits of 'uSerial64'.ETL_UINT32 uSerial;
/// @brief Explicit padding. Written as zero.ETL_UINT32 uReserved;
/// @brief First eight bytes of the SHA-256 of the licensee name, or zero.ETL_UINT64 uLicenseeTag;
/// @brief One of the ETLC_BUNDLE_EDITION_* values.ETL_UINT32 uEdition;
/// @brief ETLC_BUNDLE_FLAG_* bits.ETL_UINT32 uFlags;
/// @brief Last valid day, in days since 1970-01-01. Zero means the/// license never expires.ETL_UINT32 uValidUntilDays;
/// @brief End of support, in days since 1970-01-01: the last release/// day this license covers.ETL_UINT32 uSupportEndDays;
/// @brief Serial number of the license. Unique per issuance.ETL_UINT64 uSerial64;
} ETLC_BundleInfo;
Read-only copy of the license currently unlocked.
The struct grew at the end with format v3 (64 bytes). A caller compiled against the 40 byte version still works: ETLC_BundleQuery fills only the fields that fit in the 'iStructSize' it receives.
typedefstructETLC_BundleStateInfo
{
/// @brief 'sizeof( ETLC_BundleStateInfo )'. A smaller value is refused.ETL_UINT32 iStructSize;
/// @brief One of the ETLC_BUNDLE_STATE_* values.ETL_INT32 iState;
/// @brief Days left in the evaluation, counting today. Zero outside it.ETL_UINT32 uEvaluationDaysLeft;
/// @brief Why the last license passed was refused, as a status code./// ETLC_OK when none was.ETL_INT32 iLastRefusal;
} ETLC_BundleStateInfo;
Dashes, spaces and letter case are ignored, and I, L and O are read as 1, 1 and 0. Once a call succeeds the state latches and every later call returns ETLC_BUNDLE_OK.
sSerial
The serial, null terminated. Cannot be null.
ETLC_BUNDLE_OK, or one of the ETLC_BUNDLE_ERR_* codes.
intETLC_BundleQuery( ETLC_BundleInfo * pOut ) noexcept;
Reads back the license currently unlocked.
pOut
Receives the license. 'iStructSize' must be filled in by the caller, with sizeof( ETLC_BundleInfo ) or with ETLC_BUNDLE_INFO_SIZE_V1. The other fields are untouched when the call fails.
ETLC_BUNDLE_OK, ETLC_ERR_INVALID_ARGUMENT, or ETLC_BUNDLE_ERR_NOT_UNLOCKED.