Cosa fa
- La firma viene verificata prima di leggere qualsiasi parte del contenuto
- Report che elenca ogni problema, invece di un singolo <code>IsLicensed()</code>
- Periodo di aggiornamenti confrontato con la data di build
- Vincolo alla macchina M su N e una chiave di attivazione leggibile
- Lista di revoca e protezione contro un orologio riportato indietro
- Attivazione offline e licenze floating (lease HMAC)
- Estensioni firmate e rotazione delle chiavi
Misurato
- Non è un dato di tempo: la firma viene verificata una sola volta, al caricamento, e la ricerca di una funzionalità è il test di un singolo bit
- Licenza floating: 1000 client e 100 posti, mai più di 100 contemporaneamente, con orologi sfasati
Limiti noti
- Come ogni licenza lato client, il controllo può essere patchato nel binario
- Il server di lease è un riferimento e non gestisce la rete. La rete è lasciata all'integratore
Ethereal::Licensing · Tier 1
This does not license Ethereal. It is a kit that the customer buys and embeds in their product, to license their users. The authority is the customer, not us. The module ships no endpoint at all and does not phone home. A build without
ETL_LICENSINGcontains none of this, byte for byte.
---
What this is, in one sentence
Asymmetric (Ed25519) signatures: the customer embeds a public key and verifies. The private key never leaves the issuer's infrastructure. A symmetric key would be forgeable the moment someone dumped the binary, because the key that verifies would be the same key that signs. That path is rejected by design.
What the asymmetric signature buys, without exaggeration: it prevents anyone from becoming a license vendor. Without the private key there is no generator. The attack stops being "run a keygen" and becomes "patch each customer's installation, one by one".
---
The three audiences, separated on purpose
| Piece | Who carries it | What it has | Where it lives |
|---|---|---|---|
Client (manager.hpp, format.hpp, activation.hpp, revocation.hpp, clock_guard.hpp, offline_activation.hpp, lease.hpp) | the customer's product, on the end user's machine | public keys only, verifies only | inside the distributed product |
Issuer (issuer.hpp, lease_server.hpp) | the customer's backend | signs, handles the private key | never distributed to the user |
Glue to Crypto (glue/licensing_crypto.hpp) | whoever wants the real Ed25519 | connects ISignatureVerifier/ISigner to Crypto::Ed25519 | target Ethereal::LicensingCryptoGlue |
The client side has no path at all that signs. The signing seam is an interface (ISignatureVerifier). ISigner, which signs, exists only in the issuer header.
---
The non-negotiable rules
- Canonical encoding. Fixed field order, fixed-width little-endian integers, fixed-size strings. Two encoders producing different bytes for the same license would be a signature failure waiting to happen. A single place writes and reads (
format.cpp). - Verify the signature first, parse the payload afterwards. This is structural and does not depend on convention:
DecodeAndVerifyis the only door, and no payload byte is touched before the signature checks out. A caller cannot parse without verifying. - **There is no
bool IsLicensed(). Validation returns all** problems, each with its own state (SValidationReport). The consequence happens somewhere else, later: the product degrades instead of blowing up. A system that actually locks out a paying customer costs more than piracy does.bAllClearis the result of no problem having been found, and on purpose it is not a standalone bool that anopcan settle. - The update window compares against the build timestamp, never against the clock. A binary built inside the window runs forever, at any system date. One built afterwards refuses, and says why. There is nothing to gain by changing the date, and these are the semantics of a perpetual license with a paid window (
IsBuildCovered). - M-of-N machine binding, without requiring an exact match. A machine that replaces a network card or a disk still meets the threshold, and does not generate a support ticket. The raw serial never leaves the machine and never enters the license. Only the hash goes in (GDPR/LGPD).
---
The activation key, meant for a person
ETL-XXXXX-XXXXX-XXXXX-XXXXX, Crockford base32 (no I, L, O, U) with a weighted mod 37 check symbol at the end. It proves nothing on its own: it is an identifier that the issuer resolves. What it provides is a typo caught before any network call. It catches every single-character error and every adjacent transposition, which are the mistakes a person makes when copying a key.
---
How it is wired (minimal example)
// --- customer backend (issuer) ---
Glue::CEd25519Signer signer;
signer.Init( seed32 ); // the seed lives only here
CIssuer issuer;
issuer.Init( &signer, /*keyId*/ 2 );
issuer.IssueLicense( spec, out, cap, &written ); // deterministic
// --- customer product (verifier) ---
Glue::CEd25519Verifier verifier;
SLicensingParams p;
p.uProductHash = HashName( "acme-editor" );
p.iBuildEpochUnix = kBuildEpoch; // this binary's timestamp
p.pVerifier = &verifier;
p.pPublicKeys = publicKeys; p.pKeyIds = keyIds; p.uKeyCount = n;
CLicenseManager mgr;
mgr.Init( p );
mgr.LoadFromMemory( bytes ); // verifies the signature right here
SValidationReport r;
mgr.Validate( now, &r ); // returns all problems
if( mgr.HasFeature( 3 ) ) { ... } // < 5 ns, a bit testIn production, CEd25519Signer would give way to an HSM/KMS adapter through the same ISigner seam, without the key passing through the process memory.
---
The online layers
Four pieces, all with the same design as the rest: fixed size, no heap on the client, canonical encoding and the signature verified before a single payload byte is read.
Domain separation
The license, the revocation list, the activation response and the lease response can come from the same key. Without care, a message signed for one purpose would serve for another: a revocation list repackaged in a license header passes the signature check (it is the same key over the same bytes). That is why each new payload starts with its tag (ETRV, ETAR, ETLG), signed with it and checked after the signature, and a license whose schema is one of those tags is rejected on read and on issue. The test signs a tagged payload that, without this rule, would be a valid license. With the rule disabled, the test fails (verified).
The revocation list (revocation.hpp)
Issued by CIssuer::IssueRevocationList (it sorts and removes duplicates in the caller's memory), signed, with a serial number that only goes up. The manager loads the list with LoadRevocationList( bytes, uMinSequence ). The integrator persists the last accepted number (AcceptedRevocationSequence), and an older list gives eStale. Without this, restoring the list from before the revocation would be enough. A newer list without the identifier lifts the revocation. The reader rejects an out-of-order list (the search is binary, and an out-of-order list would hide an identifier). The list is not copied: the manager keeps only the verdict for the loaded license, and loading another license discards it. Up to 2^20 identifiers (8 MiB).
The clock that runs backwards (clock_guard.hpp)
CClockGuard keeps the highest time ever seen (the mark) in several slots (the IClockMarkStore seam: a file, the registry, the data folder), and:
- detects and reports: a time below the mark, beyond the tolerance (two hours by default), gives
eClockRollback, andbClockRollbackin the manager's report (it was the padding byte ofSValidationReport, so the size did not change). - does not let the rollback take effect: with the guard attached (
AttachClockGuard), the manager evaluates validity with the maximum of the clock and the mark. A 30-day evaluation with the clock set back to day 15 remains expired (tested. Without the guard, it was extended). - raises the mark with signed times (the license issue time, the list issue time, the lease server time): a clock that is behind is caught even on the first run.
Honest limit: whoever erases all the slots erases the guard's memory. The checksum of each slot catches corruption and marks from another product. This is not security, and cannot be, in a client that runs on the adversary's machine. ValidSlots() == 0 on a machine where the product has already run is a signal the integrator can use.
Activation without a network (offline_activation.hpp)
- The machine without a network creates a request (
CreateActivationRequest): the activation key (the check symbol is verified here), the product, the hashes of the machine identity and a nonce. That is 120 bytes, with a checksum that catches a changed byte. The integrator stores the pending request and carries the bytes to a machine with a network (file, QR, email). - The backend checks the key against its own database and calls
CIssuer::IssueActivationResponse: a license bound to the identity in the request (M-of-N threshold: the one inSpec, or a majority), plus the echo of the nonce and the key, all signed (≤ 1024 bytes). - The machine accepts it (
AcceptActivationResponse) against the pending request, and deletes the pending request.
What was tested: A's response on machine B gives eReplay (another nonce). B with A's request and response can accept it, but the license is A's and on B it gives bMachineMismatch. The same response against a new request from A gives eReplay. A tampered byte gives eBadSignature. A signed response whose license has another binding gives eMachineMismatch.
The floating license (lease.hpp, lease_server.hpp)
The seat is a time-limited loan: the server grants a lease that ends (five minutes by default), and the client (CLeaseClient, with no thread: the integrator calls Tick) renews at half the term. A client that dies does not return the seat, and does not need to: the term ends and the server takes it back. Without a network, the seat is valid until the end of the term, and no longer. The term is measured on the client's clock, from what the server said was left, so the clocks do not need to agree. The response is signed and echoes the request nonce: a recorded grant cannot be replayed.
The reference server (CLeaseServer) counts seats in a table supplied by the integrator, and answers a repeated request (the response was lost) with the same seat. It is a reference, not a service: it does not speak network (the integrator connects Handle to whatever they have).
The table persists (2026-09-29): ExportState gives the state (the leases, the last sequence of each, the counter, with a checksum that catches a damaged file), and ImportState restores that state into a new server, which continues the leases instead of forgetting them (tested: the next renewal is recognized in a single exchange). Without the state, the restarted server forgets, and the clients request again in the same call.
Clients authenticate (2026-09-29, protocol 2): with a 32-byte secret per installation (which the vendor gives to each customer, at activation for example) and an IMac (Glue::CHmacSha256), the request carries a sequence and an HMAC-SHA-256. The server with the secrets (ILeaseSecrets) rejects a request without an HMAC, with the HMAC of another secret or from a client it does not know (someone inventing identities to take all the seats), and a request with an old sequence (the replay of a recorded renewal, which would keep someone else's seat). Both rejections are proven by the test failing when the check is disabled. The sequence starts from the time (seconds shifted by 20 bits), so it keeps rising after a process restart. What it does not cover: replaying a seat request when that client no longer has any seat gives it a seat again (for one term). This ties up a seat in that client's name, and gives nothing to whoever replays it. Without secrets, protocol 1 applies: it counts seats for honest clients, and does not defend against anyone impersonating another client.
1000 clients, 100 seats (licensing.online, with a test signature so the simulation is fast. The protocol is measured separately with Ed25519): at the first instant, exactly 100 have a seat. 30 die and their seats get a new owner after the term. 20 return the seat on shutdown and the seats are released immediately. With mismatched clocks (0, +2 h, −1 day), never more than 100 at the same time, over 150 steps of 10 s. 150 different clients held a seat. ≈ 15,000 exchanges.
---
Extensions (format compatibility)
After the fixed payload, a license can carry extensions (2026-09-29), covered by the same signature: u16 tag | u16 flags | u32 length | bytes, in strictly increasing tag order. A client that does not know an extension ignores that extension, unless it is critical (LICENSE_EXT_CRITICAL). Critical means "without understanding this the license is not valid", and gives eSchemaTooNew, unless the client declares it understood (SLicensingParams::pUnderstoodCriticalTags). Tags 0x8000 to 0xFFFF belong to the vendor: custom signed fields that the product reads with CLicenseManager::GetExtension (the issuer writes them with CIssuer::IssueLicense( spec, extensions, ... )). Up to 4 KiB of extensions. The license file now fits in LICENSE_FILE_MAX (8 KiB).
One thing changed: previously, extra bytes after the payload were ignored. Now only a well-formed extension area may be there, and anything else is eMalformed. The issuer never wrote extra bytes, so no license it issued changes.
---
The patching review (the "deferred failure")
The rule: no branch whose inversion, on its own, grants entitlement. Reviewed in the source code (2026-09-29), point by point, for what a one-instruction patch can achieve:
| Point | Inverted, it gives | Why it stays this way |
|---|---|---|
The signature check (Verify, or the branch that follows it in DecodeAndVerify) | forged licenses accepted | The limit of any client-side license: the verifier runs on the adversary's machine. The defense is the server (authenticated lease, revocation) |
The error return of LoadFromMemory | nothing: the payload is only parsed after the signature checks out, so with the branch inverted the manager keeps the license it already had (the default one, with no features, no limits, no seats, or a previous genuine one), and never the forged one | deferred failure by design |
A check in Validate | erases one problem from the report | each problem is a field. bAllClear is only the result of none having been found |
The final line of Validate (bAllClear) | bAllClear with problems | decide by the fields (bExpired, bRevoked...), and not by bAllClear alone |
The clock guard report (Observe) | hides the rollback | validity is evaluated through another path (EffectiveNow): tested, the evaluation remains expired |
HasFeature (a bit test) | the feature turns on | the requirement (< 5 ns) does not allow more. Query in several places, and prefer values (GetLimit) to branches |
The lease HasSeat | the seat "exists" on this machine | the server does not count it: the other clients remain limited |
Conclusion: no branch in the module, inverted on its own, turns a forged license into a valid one without also inverting the signature check, which is the limit written down in "Honest limits". What the integrator does with the report (deferring the consequence, spreading it out) is up to them. The recommendations are in the table.
---
The C layer: client only
ethereal/c/licensing/licensing.h. Complete client surface: the opaque manager handle, loading, validating, querying features and limits, the activation key, name hashing, the build window. And the client side of the online layers: the revocation list in the manager, the clock guard (the mark slots through function pointers), activation without a network, the lease client (the exchange, and the protocol 2 HMAC, through function pointers) and the extensions (ETLC_LicManagerGetExtension, and the understood critical tags in ETLC_LicParams, read only when iStructSize covers them). The issuer and the lease server have no C layer: signing requires the private key, which lives in the backend, and not in a native executable.
The signing seam crosses as a function pointer (ETLC_LicVerifyFn): the core does not know how to do Ed25519, and the caller connects its own verifier. The machine identity comes in through the same door (ETLC_LicCollectFn). The licensing.online test suite makes the round trip through the C layer (activation, revocation, guard, lease) with the real Ed25519 behind the pointers.
---
Honest limits (read this before selling)
- A client-side license is always breakable. The verifier runs on the adversary's machine. Nobody, with any cryptography, can prevent the adversary from skipping the check by patching the binary. What this buys is friction against casual sharing, seat control inside organizations and an audit trail. It does not buy impossibility of piracy, and selling it that way is a support and reputation liability.
- What really protects is server-side authority. For any product with a service component, license the service, not the binary.
- Watermarking and revocation beat obfuscation in the case of sharing inside organizations, which is where most of the revenue leaks.
- Design so that a false negative (a paying customer, rejected) is much more expensive than a false positive (a pirate, accepted), because commercially it is.
---
Implementation status
Against the spec acceptance table (§16). What is done is measured by the test suites licensing (50 checks, real Ed25519 through the glue), licensing.online (119: the online layers, the extensions and their C layer), licensing.cabi.c11/c17 (32 each, the C surface compiled as C) and licensing.fuzz.
| Criterion | Status |
|---|---|
| Disabled build identical byte for byte | ✅ sources out of the build, behind ETHEREAL_LICENSING |
| Client without signing code | ✅ ISigner only in the issuer header. The client has only ISignatureVerifier |
| Verification < 100 µs, once on load | ✅ one verification in LoadFromMemory. Later queries do not pay |
| Feature check < 5 ns, one bit, zero allocation | ✅ HasFeature is a bit test |
| Forgery: tampered payload, swapped signature, wrong keyId, truncated file | ✅ all four rejected, covered by tests |
| Canonical encoding round trip identical byte for byte | ✅ deterministic. Tested on MSVC and GCC (Windows and Linux, the latter only since 2026-09-28: until then the Linux trees did not link the module) |
| Key rotation (signs with B, client has A and B) | ✅ selection by keyId. eUnknownKeyId distinct from eBadSignature |
| Build window against timestamp, immune to the clock | ✅ IsBuildCovered |
| M-of-N binding with hardware changes | ✅ tested above and below the threshold |
| Format compatibility (v1 reads unknown v2) | ✅ (2026-09-29) the extensions: unknown ones are ignored, unknown critical ones give eSchemaTooNew. A newer format version does too |
| Deferred failure (no branch whose inversion grants entitlement) | ✅ (2026-09-29) source code review, point by point (see above). ⚠️ the signature check is the limit of any client-side license |
| Floating lease (1000 clients, seat reclamation) | ✅ CLeaseClient + reference CLeaseServer. 1000 clients, never more than 100 out of 100. (2026-09-29) clients authenticated by HMAC with sequence, and the table persisted. ⚠️ the server does not speak network (that belongs to the integrator) |
| Offline activation (round trip, rejection by machine/replay) | ✅ (2026-09-28) request with nonce, signed response with echo. Other machine and replay rejected |
| Revocation list | ✅ (2026-09-28) signed, with anti-rollback serial number. In the manager (bRevoked) |
| Clock rollback detected and reported | ✅ (2026-09-28) CClockGuard, mark in several slots. Reported and without effect on validity. ⚠️ erasing all slots erases the memory |
| Domain separation between the signed messages | ✅ (2026-09-28) tag in the payload. Proven by the test failing without the rule |
| Activation key only in canonical form | ✅ (2026-09-28) the reader rejects nonzero top characters and the 65th bit. Previously it accepted, through an undefined shift, a second key for the same value. Tested with all 37 check symbols |
| Parser fuzzing | ✅ licensing.fuzz: the license (with extensions), the list, the activation request and response, the lease request (protocols 1 and 2) and response, the server state, the clock mark and the key. It counts how many inputs each reader accepted, to show that the fuzzer gets past the first checks |
| ASan/UBSan/TSan sanitizers | ✅ (2026-09-28) the module builds and passes on Linux with all three. UBSan caught the activation key defect |
Legend: ✅ done and tested · ⚠️ partial · ❌ not yet.
The offline core (format, canonical encoding, verify then parse, manager, build window, M-of-N binding, activation key, issuer, Ed25519 glue, client C ABI), the online layers (authenticated and persisted lease, activation without a network, revocation, clock guard), the extensions and the patching review are done, with fuzzing and sanitizers. What remains is on the client side and has no solution there: the signature check can be patched, and erasing all the clock mark slots erases the guard's memory.
---
Non-goals
Payment processing, subscription billing, a hosted license server (we deliver the protocol and the issuer library, not the service), user account management, media content DRM, telemetry.