YojigenPoint.Security 1.0.1

dotnet add package YojigenPoint.Security --version 1.0.1
                    
NuGet\Install-Package YojigenPoint.Security -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="YojigenPoint.Security" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="YojigenPoint.Security" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="YojigenPoint.Security" />
                    
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 YojigenPoint.Security --version 1.0.1
                    
#r "nuget: YojigenPoint.Security, 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 YojigenPoint.Security@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=YojigenPoint.Security&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=YojigenPoint.Security&version=1.0.1
                    
Install as a Cake Tool

YojigenPoint.Security

MIT License Nuget

YojigenPoint.Security is a modern, professional security library for .NET, providing robust and easy-to-use services for common cryptographic operations. It is designed with a focus on security best practices, performance, and testability.

This library abstracts away complex cryptographic implementations behind simple interfaces, allowing developers to secure their applications without needing to be security experts.

Features

  • Password Hashing: A service-based implementation of the industry-standard BCrypt algorithm for securely hashing and verifying passwords.
  • Symmetric Encryption: A robust implementation of AES-256 encryption. It correctly uses a PBKDF2-derived key, a random salt, and a random IV for every encryption operation, following modern security best practices.
  • Dependency Injection Ready: All services are exposed via interfaces (IPasswordHasher, IEncryptionService) for easy integration into modern .NET applications using DI containers.

Installation

This library is distributed as a NuGet package. You can add it to your project using the .NET CLI:

dotnet add package YojigenPoint.Security

Usage

1. Registering the Services

In your Program.cs or startup configuration, register the services with your DI container.

using YojigenPoint.Security.Abstractions;
using YojigenPoint.Security.Services;

// ...

// The Password Hasher is stateless, so it can be a Singleton.
builder.Services.AddSingleton<IPasswordHasher, BCryptPasswordHasher>();

// The Encryption Service requires a master key, which should be loaded from a secure configuration source.
var encryptionKey = builder.Configuration["EncryptionMasterKey"];
builder.Services.AddSingleton<IEncryptionService>(new AesEncryptionService(encryptionKey));

2. Using the Services in Your Application

Inject the interfaces into your classes via the constructor.

public class MyUserService
{
    private readonly IPasswordHasher _passwordHasher;
    private readonly IEncryptionService _encryptionService;

    public MyUserService(IPasswordHasher passwordHasher, IEncryptionService encryptionService)
    {
        _passwordHasher = passwordHasher;
        _encryptionService = encryptionService;
    }

    public void RegisterUser(string password, string personalData)
    {
        // Hash the password for storage
        string passwordHash = _passwordHasher.Hash(password);

        // Encrypt sensitive data
        string encryptedData = _encryptionService.Encrypt(personalData);

        // ... save to database ...
    }
}

License

This project is licensed under the MIT License. See the LICENSE.md file for details.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 109 8/17/2025
1.0.0 64 8/16/2025

Bug fixes: corrected a critical bug. This fix ensures the interface is correctly exposed and can be referenced by consuming projects.