Phase 07 complete: - IMachineFingerprint + ILicenseValidator interfaces - MachineFingerprint: WMI CPU ProcessorID + BaseBoard SerialNumber - LicenseValidator: RSACryptoServiceProvider + SHA256, injectable public key - LicenseFile.TryRead: out-param bool, no exceptions from file I/O - 6 NUnit tests (valid/wrong-machine/tampered/empty/not-base64/missing-file) - 118 tests total, 116 pass, 2 Fanuc FOCAS ignored (Windows DLL) - Fix: missing 'using System' in CncMachineFactoryTests.cs - Fix: Dockerfile.test updated for NcProgramManager rename PublicKeyXml = PLACEHOLDER until Phase 09 generates real key pair. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
26 lines
631 B
C#
26 lines
631 B
C#
using System.IO;
|
|
|
|
namespace NcProgramManager.Licensing
|
|
{
|
|
internal static class LicenseFile
|
|
{
|
|
internal static bool TryRead(string path, out string base64)
|
|
{
|
|
base64 = null;
|
|
try
|
|
{
|
|
if (!File.Exists(path))
|
|
return false;
|
|
string content = File.ReadAllText(path).Trim();
|
|
if (string.IsNullOrEmpty(content))
|
|
return false;
|
|
base64 = content;
|
|
return true;
|
|
}
|
|
catch
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|