Run the versions you paid for, forever
A perpetual license with a maintenance window lets a customer run every version released while their updates were active — forever — but not the versions you ship after they lapse. Here is how to model that in a single signed Keyright license: a maintenance-through claim, the build release date baked into your assembly, and the one comparison that must never fail closed.
Most time-based licensing models answer one question: is the license still valid right now? A subscription expires, the app checks the clock, and past the date it fails closed. That is the right shape for a rental. It is the wrong shape for the oldest commercial model in desktop software: buy it once, own it forever, pay separately to keep getting updates.
In that model the license never expires for running the product. What expires is the customer’s entitlement to new builds. A customer who bought version 2.0 with a year of maintenance can run 2.0 — and every version you shipped during that year — for the rest of time. When the next year’s release lands and their maintenance has lapsed, that build is simply not theirs yet. This is sometimes called a perpetual-fallback license, and getting it right hinges on one comparison that, unlike every other expiry check you have written, must not fail closed.
The contract: perpetual to run, a window to update
Separate the two clocks in your head, because the whole design follows from keeping them apart:
- The license lifetime is forever. The
KindisPerpetual, theExpiryUtcisnull, andValidate()returnsIsValid = truefor the rest of the license’s life. Nothing here ever ticks down. - The maintenance window is a date — call it
maintenance_through. It says: this customer is entitled to any build you released on or before this day. It is not an expiry. It never makes the license invalid. It only answers whether a particular build is covered.
Because a perpetual license has no ExpiryUtc, you cannot smuggle the maintenance date into the expiry field without turning the whole license into a subscription that fails closed — which would lock the customer out of software they own the moment maintenance lapsed. The maintenance window is its own claim, deliberately kept off the expiry path.
{
"sub": "acct_8f21c",
"tier": "pro",
"kind": "perpetual",
"iat": "2026-11-12T00:00:00Z",
"exp": null,
"claims": {
"maintenance_through": "2027-11-12"
}
}
One signed object. exp is null, so the license runs forever. maintenance_through is a date the customer can see on their receipt, and it governs exactly one thing: which builds they may run.
Why a date, not a version number
The naive instinct is to stamp a maximum version into the license — “licensed up to 2.x”. Resist it. Semantic versions are a graph, not a line. You might ship 2.4.1 as a security patch to the old branch after 3.0 has already shipped on the new one. Now “is this version within the licensed range” is a question about branch topology, and every answer you give is arguable.
A release date is a single monotonic axis. A build was published on a day; maintenance ran through a day; one is before or after the other, with no ties to reason about. So the license carries a date, and each build carries the date it was released. You compare two fixed numbers.
Bake the release date into the build
The build has to know when it was released. A compile-time assembly attribute is the natural home, but set it from the release — the moment your pipeline publishes the artifact — not from whatever clock the local machine had during a dev build. Pass it in from CI as an MSBuild property:
<!-- ReleaseDate is supplied by the release pipeline:
dotnet build -p:ReleaseDate=2027-10-14 -->
<PropertyGroup>
<ReleaseDate Condition="'$(ReleaseDate)' == ''">1900-01-01</ReleaseDate>
</PropertyGroup>
<ItemGroup>
<AssemblyMetadata Include="ReleaseDate" Value="$(ReleaseDate)" />
</ItemGroup>
The 1900-01-01 default is deliberate: a build that was not produced by the release pipeline (someone’s laptop) reads as impossibly old and is covered by any real license, so local builds never trip the check. Read it back once at startup:
static class BuildInfo
{
public static DateOnly ReleaseDate { get; } =
typeof(BuildInfo).Assembly
.GetCustomAttributes<AssemblyMetadataAttribute>()
.Where(a => a.Key == "ReleaseDate")
.Select(a => DateOnly.ParseExact(a.Value!, "yyyy-MM-dd"))
.DefaultIfEmpty(new DateOnly(1900, 1, 1))
.First();
}
The one comparison that must not fail closed
Every other expiry check you have written reads “now” and refuses service past a date. This one does not touch the clock at all. Both operands are fixed: the build’s release date is a constant baked into the assembly, and the maintenance date is a signed claim you have already verified offline. You are asking a single question — was this build released during the window the customer paid for?
public enum MaintenanceStatus { Covered, OutsideWindow }
public MaintenanceStatus CheckMaintenance(LicenseInfo info)
{
// Validate() already confirmed the signature and that this is a valid,
// paid, perpetual license. The only question left is which BUILDS it covers.
DateOnly? through = info.Claims.GetDate("maintenance_through");
// No maintenance claim means lifetime updates (e.g. a tier that never
// gates versions). Absence is NOT expiry — fail OPEN and cover everything.
if (through is not { } cutoff)
return MaintenanceStatus.Covered;
return BuildInfo.ReleaseDate <= cutoff
? MaintenanceStatus.Covered // released on/before the cutoff → licensed, forever
: MaintenanceStatus.OutsideWindow; // this build is newer than the customer's coverage
}
Two decisions carry the whole model. First, a missing claim fails open: a perpetual license with no maintenance window should run anything, because the absence of a window is not an expired window. Second, OutsideWindow is not an invalid state — the license is still perfectly valid and paid; the customer has simply installed a build that is newer than what they bought.
Notice what is not in that function: DateTimeOffset.UtcNow. Because neither operand depends on the current time, this check is immune to clock rollback by construction. A customer who sets their clock back five years changes nothing — the build was still released after their maintenance ran out. That is a pleasant contrast to subscription expiry, where “now” is exactly the value an attacker wants to move.
Wiring it at startup
Keep the two concerns in the order the model demands: first is this customer licensed at all, then is this build covered.
var info = client.Validate(); // offline, against the embedded public key
if (!info.IsValid || !info.IsPaid)
{
// Not a paying customer — the ordinary fail-closed path.
RunAsCommunityEdition();
return;
}
switch (licensing.CheckMaintenance(info))
{
case MaintenanceStatus.Covered:
RunLicensed(info);
break;
case MaintenanceStatus.OutsideWindow:
// Valid, paid, perpetual — they OWN the product. They have just
// installed a build released after their updates lapsed.
ShowMaintenanceLapsedNotice(info.Claims.GetDate("maintenance_through"));
RunLicensed(info); // let them keep working; see below
break;
}
The OutsideWindow branch is where products get this wrong. Failing closed to Community Edition there — stripping paid features because the customer installed an update — turns an upgrade into a downgrade and reads, correctly, as the product holding the customer’s own software hostage. The honest options are narrower:
- Recommended: let the app run and show a calm, dismissible notice — “Version 2.1 was released after your maintenance ended on 12 Nov 2027. Renew to get the latest updates, or continue on version 2.0, which your license covers permanently.” The customer keeps everything they paid for.
- Stricter, still fair: refuse to launch this build and point them at the last covered release (2.0), which they can download and run forever. You are declining to run a newer build, not revoking the license.
What you never do is drop a perpetual, paid customer to the free Community Edition because of a date that governs updates, not ownership.
The admin flow: renewing maintenance
Renewing maintenance is not a new product or a new signing key — it is the same perpetual license with the window moved forward. In the issuing service you reissue for the same account with a later maintenance_through; sub, tier, and kind are unchanged:
keyright license reissue \
--account acct_8f21c \
--kind perpetual \
--maintenance-through 2028-11-12
The customer receives the reissued license, re-activates, and every build you release through the new date becomes covered. Nothing about old installs changes — a machine still running 2.0 was already covered and stays covered. Because the maintenance date rides inside the signed payload, the only way to extend coverage is to be issued a new license; hand-editing the date in the file breaks the signature and the whole license fails verification, which is the fail-closed behaviour you do want.
A practical takeaway
Perpetual-fallback licensing is one claim and one comparison, but the comparison runs backwards from every other expiry check you own. Keep the maintenance date off the ExpiryUtc path so the license never expires for running. Compare a baked-in release date against a signed maintenance-through date, never a version string and never the wall clock. Fail open when the claim is absent, and treat a build outside the window as “newer than your coverage” rather than “unlicensed.” Done this way, letting maintenance lapse does exactly what the contract promised the customer when they bought it: they keep running every version they paid for, for as long as they like — and the day they want your newest build, renewing is a date change, not a new deal.
Try Nebula.NET
Harden your .NET code in minutes — start with the free edition.