DMS.Security
1.0.1
dotnet add package DMS.Security --version 1.0.1
NuGet\Install-Package DMS.Security -Version 1.0.1
<PackageReference Include="DMS.Security" Version="1.0.1" />
<PackageVersion Include="DMS.Security" Version="1.0.1" />
<PackageReference Include="DMS.Security" />
paket add DMS.Security --version 1.0.1
#r "nuget: DMS.Security, 1.0.1"
#addin nuget:?package=DMS.Security&version=1.0.1
#tool nuget:?package=DMS.Security&version=1.0.1
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 | Versions 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. |
-
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 |