xyToolz 1.0.31
Use newer Version
See the version list below for details.
dotnet add package xyToolz --version 1.0.31
NuGet\Install-Package xyToolz -Version 1.0.31
<PackageReference Include="xyToolz" Version="1.0.31" />
<PackageVersion Include="xyToolz" Version="1.0.31" />
<PackageReference Include="xyToolz" />
paket add xyToolz --version 1.0.31
#r "nuget: xyToolz, 1.0.31"
#:package xyToolz@1.0.31
#addin nuget:?package=xyToolz&version=1.0.31
#tool nuget:?package=xyToolz&version=1.0.31
xyHashHelper.cs
Der xyHashHelper
bietet robuste und sichere Methoden zum Hashen, Vergleichen und Abspeichern von Passwörtern, Salts und kryptografischen Schlüsseln.
📌 Features
- 🔐 Salted Hashing via PBKDF2 (Rfc2898DeriveBytes)
- 🔑 Dynamische Salt-Generierung mit Secure RNG
- 🌶️ Optionale Pepper-Absicherung via Umgebungsvariable
PEPPER
- 🧮 Unterstützt SHA256 und SHA512
- 🔁 Sichere Passwortverifikation mit
FixedTimeEquals
- 🧪 Umfangreiches Logging
- 📦 Kompatibel mit AES-Key-Derivation (z. B. für Verschlüsselung)
🔧 Konfiguration
Option | Beschreibung | Default |
---|---|---|
PEPPER |
Umgebungsvariable für zusätzliche Entropie | "Ahuhu" |
Iterations |
Wiederholungen in PBKDF2 | 100_000 |
KeyLength256 |
Keylänge für AES-256 / SHA256 | 32 Bytes |
KeyLength512 |
Keylänge für SHA512 | 64 Bytes |
📌 Methodenübersicht
Methode | Zweck |
---|---|
BuildSaltedHash() |
Erstellt neuen Salt + Hash im Format salt:hash |
VerifyPassword() |
Vergleicht Password gegen Salt+Hash |
BuildKeyFromPassword() |
Generiert AES-Schlüssel aus Passwort + Salt |
GenerateSalt() |
Erstellt sicheren Salt in gewünschter Länge |
HashToBytes() / HashToString() |
Raw-Hash oder Base64-Hash erzeugen |
TryVerifyPassword() (neu) |
Sicherer Passwort-Vergleich mit out bool |
🧪 Beispiel
``csharp // Hash erstellen string password = "MeinSicheresPasswort123!"; string saltedHash = xyHashHelper.BuildSaltedHash(HashAlgorithmName.SHA256, password, out byte[] salt);
// Passwort prüfen bool isCorrect = xyHashHelper.VerifyPassword(HashAlgorithmName.SHA256, password, saltedHash);
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xyRsa
xyRsa
is a reusable, fully static utility class designed for secure handling of JWT (JSON Web Tokens) using RSA encryption in .NET-based Web APIs or desktop applications.
It enables easy generation, validation, and management of JWTs with public/private key cryptography, aligned with modern security practices.
🔐 Features
- ✅ JWT Creation using
RS256
andSecurityTokenDescriptor
- ✅ JWT Validation with configurable lifetime and signature checks
- 🔑 Public/Private Key Loading from PEM-formatted strings
- 📦 Export Public Key as PEM
- 🏷️ Issuer & Audience configuration
- 📜 Full logging of success, failure, and exceptions via
xyLog
🧪 Example Usage
``csharp await xyRsa.LoadKeysAsync(publicPem, privatePem); await xyRsa.ConfigureAsync("MyApiIssuer", "MyAudience");
var token = await xyRsa.GenerateJwtAsync(new Dictionary<string, object> { { "sub", "user123" }, { "role", "admin" } }, TimeSpan.FromHours(1));
var principal = await xyRsa.ValidateJwtAsync(token); string pem = await xyRsa.GetPublicKeyAsPemAsync();
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Class: xyFiles
Purpose
Provides a cross-platform, static utility class for file and directory operations such as reading, writing, renaming, and deleting.
Features
- Directory management: EnsureDirectory, CheckForDirectories
- File metadata & inspection: Inventory, InventoryNames
- File I/O: ReadLinesAsync, SaveToFile, LoadFileAsync
- File manipulation: RenameFileAsync, DeleteFile
- Binary support: SaveBytesToFileAsync, LoadBytesFromFile
Thread Safety
All methods are static and stateless, ensuring thread safety by design.
Platform Compatibility
Special handling for Android via conditional compilation (#if ANDROID
).
Example
``csharp var lines = await xyFiles.ReadLinesAsync("settings.txt");
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. |
-
net8.0
- Microsoft.EntityFrameworkCore (>= 9.0.2)
- Microsoft.Extensions.Configuration (>= 9.0.3)
- Microsoft.Extensions.Configuration.Json (>= 8.0.1)
- Microsoft.IdentityModel.Tokens (>= 7.1.2)
- Newtonsoft.Json (>= 13.0.3)
- PDFsharp (>= 6.1.1)
- System.Drawing.Common (>= 8.0.8)
- System.IdentityModel.Tokens.Jwt (>= 7.1.2)
- System.IO.FileSystem (>= 4.3.0)
- System.Security.Cryptography.ProtectedData (>= 7.0.0)
- System.Text.Json (>= 9.0.2)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on xyToolz:
Package | Downloads |
---|---|
xyPortHelper
Providing basic operations for ports like: listing open ports and connections open and close ports and connections send messages via TCP or UDP |
|
ExtendedCRUD
CRUD + Pageineering + x |
|
xyAvalonia
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated | |
---|---|---|---|
1.0.56 | 164 | 8/6/2025 | |
1.0.55 | 124 | 8/4/2025 | |
1.0.54 | 102 | 8/3/2025 | |
1.0.53 | 39 | 8/3/2025 | |
1.0.51 | 39 | 8/2/2025 | |
1.0.50 | 15 | 8/2/2025 | |
1.0.49 | 18 | 8/2/2025 | |
1.0.48 | 14 | 8/2/2025 | |
1.0.47 | 21 | 8/2/2025 | |
1.0.46 | 20 | 8/2/2025 | |
1.0.45 | 18 | 8/2/2025 | |
1.0.44 | 20 | 8/2/2025 | |
1.0.40 | 173 | 7/27/2025 | |
1.0.39 | 169 | 7/27/2025 | |
1.0.38 | 167 | 5/24/2025 | |
1.0.37 | 278 | 5/11/2025 | |
1.0.36 | 215 | 5/11/2025 | |
1.0.32 | 252 | 4/29/2025 | |
1.0.31 | 227 | 4/29/2025 | |
1.0.1 | 244 | 4/29/2025 | |
1.0.0 | 246 | 4/29/2025 |