KiUtils 1.0.0.10

There is a newer version of this package available.
See the version list below for details.
dotnet add package KiUtils --version 1.0.0.10
                    
NuGet\Install-Package KiUtils -Version 1.0.0.10
                    
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="KiUtils" Version="1.0.0.10" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="KiUtils" Version="1.0.0.10" />
                    
Directory.Packages.props
<PackageReference Include="KiUtils" />
                    
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 KiUtils --version 1.0.0.10
                    
#r "nuget: KiUtils, 1.0.0.10"
                    
#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 KiUtils@1.0.0.10
                    
#: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=KiUtils&version=1.0.0.10
                    
Install as a Cake Addin
#tool nuget:?package=KiUtils&version=1.0.0.10
                    
Install as a Cake Tool

KiUtils

NuGet NuGet Downloads License

KiUtils es una librería integral para .NET 6 + / .NET Standard 2.1 que simplifica la firma electrónica y la validación OCSP, garantizando autenticidad, integridad y no repudio de la información digital.


Tabla de Contenido

  1. Características
  2. Instalación
  3. Conceptos clave
  4. Ejemplos rápidos
  5. Compatibilidad
  6. Licencia

Características

  • Generación de firma electrónica mediante algoritmos de cifrado asimétrico.
  • Validación de firma electrónica para comprobar integridad y autenticidad.
  • Consultas OCSP a múltiples autoridades de certificación.
  • Manejo de claves y certificados en formato DER, PEM, PFX y PKCS#8.
  • API asíncrona y thread-safe.
  • Cobertura de pruebas > 90 % y ejemplos listos para producción.

Instalación

dotnet add package KiUtils

Requiere .NET 6 o superior. Para proyectos antiguos, asegúrate de apuntar a .NET Standard 2.1.


Conceptos clave

Proceso Descripción
Generación de firma Calcula el hash del documento y lo cifra con la clave privada del firmante.
Validación de firma Descifra la firma con la clave pública, vuelve a calcular el hash y los compara.
OCSP Protocolo para confirmar si un certificado está vigente o revocado en tiempo real.

Ejemplos rápidos

A continuación se muestran los casos de uso más habituales. Revisa la carpeta samples/ para ejemplos completos.

Validar un certificado (OCSP)

using KiUtils.Ocsp;

byte[] cert = await File.ReadAllBytesAsync("user.cer");
byte[] issuer = await File.ReadAllBytesAsync("issuer.cer");

bool isValid = await KiOcsp.Validate(cert, issuer);

// true  → certificado vigente
// false → certificado revocado o indeterminado

Generar una firma electrónica

using KiUtils.Signature;

string messageBase64 = "o85Tiahsy/02+/id5A9VdKazikM0DLOVsDNoVSxo26w=";
byte[] privateKey = await File.ReadAllBytesAsync("private.key");
string password = "Notaria73";

string signature = KiSignature.Sign(messageBase64, privateKey, password);

// signature contiene la firma en Base64

Validar una firma electrónica

using KiUtils.Signature;

string messageBase64 = "o85Tiahsy/02+/id5A9VdKazikM0DLOVsDNoVSxo26w=";
string signatureBase64 = "AP9Cmpqkh5...";
byte[] certificate = await File.ReadAllBytesAsync("user.cer");

bool isValid = KiSignature.IsValid(signatureBase64, messageBase64, certificate);

// isValid == true → firma auténtica e íntegra

Compatibilidad

Plataforma Versión mínima
.NET 6.0
.NET Standard 2.1
Windows / Linux / macOS

Licencia

Este proyecto se distribuye bajo la licencia MIT. Consulta el archivo LICENSE para más detalles.

KiUtils se ofrece “tal cual”, sin garantías explícitas o implícitas; úsalo bajo tu propio riesgo.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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.

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.0.11 283 6/11/2025
1.0.0.10 281 6/11/2025
1.0.0.9 176 12/5/2023

- Nuevo método de verificación de Firma Electrónica