Nishuihanlong 2.0.1
dotnet add package Nishuihanlong --version 2.0.1
NuGet\Install-Package Nishuihanlong -Version 2.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="Nishuihanlong" Version="2.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nishuihanlong" Version="2.0.1" />
<PackageReference Include="Nishuihanlong" />
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 Nishuihanlong --version 2.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Nishuihanlong, 2.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 Nishuihanlong@2.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=Nishuihanlong&version=2.0.1
#tool nuget:?package=Nishuihanlong&version=2.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
修复伪造token的漏洞
LtpaToken组成原理
LtpaToken的合成公式如下:
[token] = BASE64([header][creation time][expiration time][username][SHA-1 hash])
上面的SHA-1校验和,又是由共享密钥和其余的Token资料合并而成,合成公式如下:
[SHA-1 hash] = SHA-1([header][creation time][expiration time][username][shared secret])。
MVC Demo
public IActionResult Index()
{
var cookie = HttpContext.Request.Cookies["CookieName"];
if (!string.IsNullOrEmpty(cookie))
{
string secretKey = "your key";
var result = Ltpatoken.parseToken(cookie, secretKey);
if (result["resultCode"] == "1")
{
ViewBag.LoginName = result["result"];
}
else
{
//失败
ViewBag.LoginName = result["result"];
}
return View();
}
else {
return View("403");
}
}
ConsoleApplication Demo
string secretKey = "your secretkey";
var result = Ltpatoken.parseToken("AAECAzY1QThCREI2NjVBOTY2NzYxMWp3YW5nc2h1YW5nFPPsIGsFaz12CMTTamSGdgSfiUo=", secretKey);
| Product | Versions 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.