---
phase: 08-license-integration
plan: 01
type: summary
status: complete
completed: 2026-05-17
---

# Phase 08 Summary: license-integration

## What Was Built

RSA license check wired into `Program.cs`. Old AES-based `checkLicense` deleted. License now validated at startup against `license.lic` in the EXE directory.

**Files modified:**
- `Program.cs` — license check replaced, `checkLicense` deleted, `-chiave=` parsing removed, `MostraAiuto` updated
- `InputArgs.cs` — `chiave` field removed

## Acceptance Criteria Results

| AC | Result | Notes |
|----|--------|-------|
| AC-1: -chiave= arg still parsed | **SUPERSEDED** | User directed removal mid-APPLY (see Deviations) |
| AC-2: RSA license check at startup | PASS | `MachineFingerprint` + `LicenseFile.TryRead` + `LicenseValidator.Validate` wired |
| AC-3: License failure exits -100 | PASS | `Console.WriteLine("Licenza ERRATA")` + `vediErrore(-100)` + `return -1` |
| AC-4: Help text updated | PASS | `-chiave=` block replaced with `license.lic` location note |

## Deviations

**Plan AC-1 superseded by user decision.**
Plan stated: keep `-chiave=` as the CLI arg carrying the `.lic` file path.
User directed mid-APPLY: remove `-chiave=` entirely; hardcode `license.lic` next to the EXE.

Actual license path:
```csharp
string _licPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "license.lic");
```

`inputArgs.chiave` field removed from `InputArgs.cs`. All `-chiave=` parsing removed from `parseArgomenti`.

## Verification (post-apply grep)

```
grep "checkLicense|chiave|System.Management|System.Security.Cryptography" Program.cs → 0 hits
grep "MachineFingerprint|LicenseFile|LicenseValidator|NcProgramManager.Licensing" Program.cs → 5 hits
grep "chiave" InputArgs.cs → 0 hits
```

## Decisions Made

- License file always at `AppDomain.CurrentDomain.BaseDirectory + "license.lic"` — no CLI override
- `InputArgs.chiave` field deleted (not just unused) — cleaner than leaving dead field
- `AesCrypt.cs` left on disk (still in csproj, no cleanup in scope)

## Deferred Issues

- Real RSA key pair — Phase 09 generates; copy `PublicKeyXml` into `LicenseValidator.cs`
- Phase 09: separate `LicenseGenerator` console app — reads WMI fingerprint, signs, writes `.lic`
- `AesCrypt.cs` dead code — remove in future cleanup phase

## Tests

No new tests (license core tested in Phase 07). Docker build + 116 tests pass (2 Fanuc FOCAS ignored, Windows-only DLL).
