DMS.Security 1.0.1

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

DMS.Security

Paquete Nuget: DMS.Security Autor: Fredy Fuentes Versión Actual: 1.0.0

📜 Descripción

DMS.Security Biblioteca de seguridad para .NET que implementa cifrado simétrico (AES) y asimétrico (RSA, ECC). Ideal para proteger datos sensibles, gestionar claves con expiración y garantizar integridad en comunicaciones.

📝 Características Principales

  • Cifrado Asimétrico: ECC (ECDH + AES-GCM) y RSA.
  • Cifrado Simétrico: AES con soporte para claves/IV personalizados.
  • Gestión de Claves: Generación de claves públicas y privadas, metadatos y fechas de expiracion.
  • Validación Automática: Verificación de claves expiradas o metadatos inconsistentes.

📖 Ejemplos de Uso

📖 Encriptar y Desencriptar una Cadena de Texto con AES

using DMS.Security;

// Generar clave y vector de inicialización
var aes = new AesEncryption(out string key, out string iv);

// Encriptar texto
string encryptedText = aes.Encrypt("Hello, World!");

// Desencriptar texto
var aesWithExistingKey = new AesEncryption(key, iv);
string decryptedText = aesWithExistingKey.Decrypt(encryptedText);

Console.WriteLine($"Encrypted Text: {encryptedText}");
Console.WriteLine($"Decrypted Text: {decryptedText}");
// Output:
// Encrypted Text: <encrypted-text>
// Decrypted Text: Hello, World!

📖 Encriptar y Desencriptar una Cadena de Texto con RSA

using DMS.Security;

// Generar clave pública y privada
var sender = RsaEncryption.GenerateKeys(out string senderPublicKey, out string senderPrivateKey);
var receiver = RsaEncryption.GenerateKeys(out string receiverPublicKey, out string receiverPrivateKey);

// Encriptar texto con clave pública del receptor
string encryptedText = sender.Encrypt("Hello, World!", receiverPublicKey);

// Desencriptar texto con clave privada del receptor
string decryptedText = receiver.Decrypt(encryptedText, receiverPrivateKey);

Console.WriteLine($"Encrypted Text: {encryptedText}");
Console.WriteLine($"Decrypted Text: {decryptedText}");
// Output:
// Encrypted Text: <encrypted-text>
// Decrypted Text: Hello, World!

📖 Encriptar y Desencriptar una Cadena de Texto con ECC

using DMS.Security;

// Generar clave pública y privada
var sender = EccEncryption.GenerateKeys(out string senderPublicKey, out string senderPrivateKey);
var receiver = EccEncryption.GenerateKeys(out string receiverPublicKey, out string receiverPrivateKey);

// Encriptar texto con clave pública del receptor
string encryptedText = sender.Encrypt("Hello, World!", receiverPublicKey);

// Desencriptar texto con clave privada del receptor
string decryptedText = receiver.Decrypt(encryptedText, senderPublicKey);

Console.WriteLine($"Encrypted Text: {encryptedText}");
Console.WriteLine($"Decrypted Text: {decryptedText}");
// Output:
// Encrypted Text: <encrypted-text>
// Decrypted Text: Hello, World!

🚀 Instalación

Puedes instalar el paquete desde NuGet con:

dotnet add package DMS.Security

🛠 Compatibilidad

  • .NET 7.0+

⚠️ Mejores Prácticas

  • Claves ECC/RSA: Nunca almacenes claves privadas en código fuente o en repositorios públicos. Usa Azure Key Vault o servicios de administración de claves.
  • IV en AES: No reutilices el vector de inicialización (IV) para cifrar múltiples mensajes. Genera un IV único para cada mensaje.

📄 Documentación Completa

Clase Descripción
AesEncryption Cifrado simétrico con auto-generación de claves.
RsaEncryption Cifrado asimétrico RSA estándar con claves XML.
EccEncryption Cifrado híbrido ECDH (derivación) + AES-GCM.

📄 Licencia

Este proyecto se encuentra bajo la licencia Apache2-0.


📌 Cómo Contribuir

Si deseas contribuir, revisa el archivo CONTRIBUTING.md para más detalles.


📜 Changelog

Para ver los cambios en cada versión, consulta el archivo CHANGELOG.md.

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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on DMS.Security:

Package Downloads
DMS.Connection.Crm

Biblioteca para conexión segura con CRM. Incluye ejecución de consultas SQL.

DMS.Connection.Adv

Biblioteca para conexión segura con nodos de Advance. Incluye ejecución de consultas SQL, autenticación y gestión dinámica de nodos con cifrado.

DMS.Connection.CrmErp

Biblioteca para conexión segura con CRM-Erp. Incluye ejecución de consultas SQL.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 167 14 days ago