license-generator/Commands/KeygenCommand.cs
dtrentin 2ef68dd477 feat: initial LicenseGenerator -- keygen, fingerprint, sign commands
Standalone .NET 4.7.2 console tool for NcProgramManager offline licensing.
- keygen: RSA 2048-bit key pair generation
- fingerprint: WMI machine fingerprint (Windows only)
- sign: RSA-SHA256 sign fingerprint, write .lic file

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 23:33:30 +02:00

24 lines
896 B
C#

using System;
using System.IO;
using System.Security.Cryptography;
namespace LicenseGenerator.Commands
{
internal static class KeygenCommand
{
internal static void Execute()
{
using (var rsa = new RSACryptoServiceProvider(2048))
{
string privateXml = rsa.ToXmlString(true);
string publicXml = rsa.ToXmlString(false);
File.WriteAllText("private.key.xml", privateXml);
Console.WriteLine("=== PUBLIC KEY XML -- paste into LicenseValidator.cs ===");
Console.WriteLine(publicXml);
Console.WriteLine("========================================================");
Console.WriteLine("Private key saved: private.key.xml");
Console.WriteLine("KEEP private.key.xml SECRET -- never distribute it.");
}
}
}
}