FY.License 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package FY.License --version 1.0.1
                    
NuGet\Install-Package FY.License -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FY.License" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FY.License" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="FY.License" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FY.License --version 1.0.1
                    
#r "nuget: FY.License, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package FY.License@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FY.License&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=FY.License&version=1.0.1
                    
Install as a Cake Tool
using FY.License.Models;
using FY.License.Services;

var cryptoService = new RsaCryptoService();

// 1. 生成密钥对
Console.WriteLine("=== 生成密钥对 ===");
var (publicKey, privateKey) = cryptoService.GenerateKeyPair();

Console.WriteLine($"公钥长度: {publicKey.Length}");
Console.WriteLine($"私钥长度: {privateKey.Length}");

// 2. 测试签名和验证
Console.WriteLine("\n=== 测试签名和验证 ===");

var testData = "Hello, LicenseProtector!";
var signature = cryptoService.SignData(testData, privateKey);
Console.WriteLine($"签名: {signature.Substring(0, 50)}...");

var isValid = cryptoService.VerifySignature(testData, signature, publicKey);
Console.WriteLine($"验证结果: {isValid}");

// 3. 测试生成和验证授权
Console.WriteLine("\n=== 测试授权文件 ===");

var licenseInfo = new LicenseInfo
{
    LicenseId = "TEST-12345",
    ApplicationId = "MyApp",
    CustomerName = "Test Customer",
    IssueDate = DateTime.UtcNow,
    ExpiryDate = DateTime.UtcNow.AddYears(1),
    LicenseType = "TRIAL",
    Issuer = "LicenseProtector.NET"
};

licenseInfo.AuthorizedFeatures.Add("FEATURE_A");
licenseInfo.AuthorizedFeatures.Add("FEATURE_B");

var signedLicense = cryptoService.CreateSignedLicense(licenseInfo, privateKey);
Console.WriteLine($"授权文件生成成功,长度: {signedLicense.Length}");

try
{
    var verifiedLicense = cryptoService.VerifyAndParseLicense(signedLicense, publicKey);
    Console.WriteLine($"授权验证成功: {verifiedLicense.CustomerName}");
    Console.WriteLine($"授权ID: {verifiedLicense.LicenseId}");
    Console.WriteLine($"过期时间: {verifiedLicense.ExpiryDate:yyyy-MM-dd}");
}
catch (Exception ex)
{
    Console.WriteLine($"授权验证失败: {ex.Message}");
}

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on FY.License:

Package Downloads
FY.Http

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.0 254 7/3/2026
1.1.0 101 7/3/2026
1.0.1 133 1/20/2026
1.0.0 136 1/4/2026