Enigma.Cryptography
3.1.1
See the version list below for details.
dotnet add package Enigma.Cryptography --version 3.1.1
NuGet\Install-Package Enigma.Cryptography -Version 3.1.1
<PackageReference Include="Enigma.Cryptography" Version="3.1.1" />
<PackageVersion Include="Enigma.Cryptography" Version="3.1.1" />
<PackageReference Include="Enigma.Cryptography" />
paket add Enigma.Cryptography --version 3.1.1
#r "nuget: Enigma.Cryptography, 3.1.1"
#:package Enigma.Cryptography@3.1.1
#addin nuget:?package=Enigma.Cryptography&version=3.1.1
#tool nuget:?package=Enigma.Cryptography&version=3.1.1
Enigma
Enigma is a .NET cryptography library based on BouncyCastle.Cryptography.
Acknowledgements
Thanks to the BouncyCastle team for their outstanding work on BouncyCastle.Cryptography, which made this project possible.
Block ciphers
Classes :
BlockCipherService: Service for encryption/decryption with block ciphersBlockCipherServiceFactory: IBlockCipherService factoryBlockCipherEngineFactory: IBlockCipher factoryBlockCipherPaddingFactory: IBlockCipherPadding factory
Create block cipher service with algorithm name :
// AES-CBC without padding
var service = new BlockCipherService("AES/CBC/NoPadding");
// AES-CBC with PKCS7 padding
var service = new BlockCipherService("AES/CBC/PKCS7Padding");
Create block cipher service with factories :
// AES-CBC without padding
var engineFactory = new BlockCipherEngineFactory();
var service = new BlockCipherServiceFactory().CreateCbcService(engineFactory.CreateAesEngine);
// AES-CBC with PKCS7 padding
var engineFactory = new BlockCipherEngineFactory();
var paddingFactory = new BlockCipherPaddingFactory();
var service = new BlockCipherServiceFactory().CreateCbcService(engineFactory.CreateAesEngine, paddingFactory.CreatePkcs7Padding);
Full example :
// Create a block cipher service for AES/CBC/PKCS7Padding
var service = new BlockCipherService("AES/CBC/PKCS7Padding");
// Get the key and IV sizes
var (keySizeInBytes, ivSizeInBytes) = service.GetKeyIvSize();
// Generate random key and iv
var key = RandomUtils.GenerateRandomBytes(keySizeInBytes);
var iv = RandomUtils.GenerateRandomBytes(ivSizeInBytes);
var parameters = new ParametersWithIV(new KeyParameter(key), iv);
var data = Encoding.UTF8.GetBytes("This is a secret message !");
// Encrypt
using var inputEnc = new MemoryStream(data);
using var outputEnc = new MemoryStream();
await service.EncryptAsync(inputEnc, outputEnc, parameters);
var encrypted = outputEnc.ToArray();
// Decrypt
using var inputDec = new MemoryStream(encrypted);
using var outputDec = new MemoryStream();
await service.DecryptAsync(inputDec, outputDec, parameters);
var decrypted = outputDec.ToArray();
Stream ciphers
Classes :
StreamCipherService: Service for encryption/decryption with stream ciphersStreamCipherServiceFactory: IStreamCipherService factory
Full example :
// Create a stream cipher service for ChaCha7539
var service = new StreamCipherServiceFactory().CreateChaCha7539Service();
// Get the key and nonce sizes
var (keySizeInBytes, nonceSizeInBytes) = service.GetKeyNonceSize();
// Generate random key and nonce
var key = RandomUtils.GenerateRandomBytes(keySizeInBytes);
var nonce = RandomUtils.GenerateRandomBytes(nonceSizeInBytes);
var data = Encoding.UTF8.GetBytes("This is a secret message !");
// Encrypt
using var inputEnc = new MemoryStream(data);
using var outputEnc = new MemoryStream();
await service.EncryptAsync(inputEnc, outputEnc, key, nonce);
var encrypted = outputEnc.ToArray();
// Decrypt
using var inputDec = new MemoryStream(encrypted);
using var outputDec = new MemoryStream();
await service.DecryptAsync(inputDec, outputDec, key, nonce);
var decrypted = outputDec.ToArray();
Public-key
Classes :
PublicKeyService: Service for public-key encryption/decryption and signing/verifyingPublicKeyServiceFactory: IPublicKeyService factory
Full example :
// Create RSA public-key service
var service = new PublicKeyServiceFactory().CreateRsaService();
// Generate 4096-bits key pair
var keyPair = service.GenerateKeyPair(4096);
var data = Encoding.UTF8.GetBytes("This is a secret message");
// Encrypt/decrypt data
var enc = service.Encrypt(data, keyPair.Public);
var dec = service.Decrypt(enc, keyPair.Private);
// Sign/verify data
var signature = service.Sign(data, keyPair.Private);
var verified = service.Verify(data, signature, keyPair.Public);
// Save public key in PEM format
using var publicOutput = new MemoryStream();
service.SaveKey(keyPair.Public, publicOutput);
// Save and encrypt private key in PEM format
using var privateOutput = new MemoryStream();
service.SavePrivateKey(keyPair.Private, privateOutput, "yourpassword", algorithm: "AES-256-CBC");
// Load public key from PEM format
using var publicInput = new MemoryStream(publicOutput.ToArray());
var publicKey = service.LoadKey(publicInput);
// Load and decrypt private key from PEM format
using var privateInput = new MemoryStream(privateOutput.ToArray());
var privateKey = service.LoadPrivateKey(privateInput, "yourpassword");
Data encoding
Classes :
Base64Service: Service for base64 encoding/decodingHexService: Service for hexadecimal encoding/decoding
Full example :
var data = Encoding.UTF8.GetBytes("This is some data");
// Encode/decode with hex
var hex = new HexService();
var hexEncoded = hex.Encode(data);
var hexDecoded = hex.Decode(hexEncoded);
// Encode/decode with base64
var base64 = new Base64Service();
var base64Encoded = base64.Encode(data);
var base64Decoded = base64.Decode(base64Encoded);
Hash
Classes :
HashService: Hash serviceHashServiceFactory: IHashService factory
Full example :
var data = Encoding.UTF8.GetBytes("Data to hash");
// Create SHA3 hash service
var service = new HashServiceFactory().CreateSha3Service();
// Hash data
using var input = new MemoryStream(data);
var hash = await service.HashAsync(input);
KDF
Classes :
Pbkdf2Service: Password-based key derivation function service
Full example :
var service = new Pbkdf2Service();
var salt = new HexService().Decode("5775ada0513d7d7d7316de8d72d1f4d2");
// Generate a 32 bytes key based on a password and salt
var key = service.GenerateKey(size: 32, password: "yourpassword", salt, iterations: 10_000);
Padding
Classes :
NoPaddingService: No-padding servicePaddingService: Padding servicePaddingServiceFactory: IPaddingService factory
Full example :
var data = Encoding.UTF8.GetBytes("Data to pad");
// Create a PKCS7 padding service
var service = new PaddingServiceFactory().CreatePkcs7Service();
// Pad/unpad data with a 16 bytes block size
var padded = service.Pad(data, blockSize: 16);
var unpadded = service.Unpad(padded, blockSize: 16);
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. 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 is compatible. 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 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 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.7.2
- BouncyCastle.Cryptography (>= 2.5.1)
-
.NETStandard 2.0
- BouncyCastle.Cryptography (>= 2.5.1)
-
.NETStandard 2.1
- BouncyCastle.Cryptography (>= 2.5.1)
-
net6.0
- BouncyCastle.Cryptography (>= 2.5.1)
-
net7.0
- BouncyCastle.Cryptography (>= 2.5.1)
-
net8.0
- BouncyCastle.Cryptography (>= 2.5.1)
-
net9.0
- BouncyCastle.Cryptography (>= 2.5.1)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Enigma.Cryptography:
| Package | Downloads |
|---|---|
|
Enigma.Cryptography.DataEncryption
Stream-based encryption and decryption services for .NET, built on Enigma.Cryptography. Supports password-based (PBKDF2, Argon2id), RSA hybrid, and post-quantum ML-KEM-1024 key exchange, combined with AES-256, Twofish-256, Serpent-256, and Camellia-256 in GCM mode. |
|
|
Enigma.LicenseManager
.NET license management library |
|
|
Carbon.Avalonia.Desktop
A comprehensive Avalonia UI control library for .NET desktop applications. Includes navigation, docking, ribbon, editors, calendar/scheduling, and 2D display controls, along with a CollectionView data subsystem and dialog/overlay services. Built on Avalonia 11.3 with Fluent theme (Dark & Light variants), full MVVM support, and dependency injection integration. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.1.0 | 77 | 3/9/2026 |
| 4.0.3 | 251 | 11/28/2025 |
| 4.0.2 | 211 | 10/30/2025 |
| 4.0.1 | 405 | 8/5/2025 |
| 4.0.0 | 195 | 7/4/2025 |
| 3.5.3 | 216 | 6/30/2025 |
| 3.5.2 | 275 | 4/25/2025 |
| 3.5.1 | 273 | 4/21/2025 |
| 3.5.0 | 244 | 4/20/2025 |
| 3.4.0 | 263 | 4/16/2025 |
| 3.3.0 | 166 | 4/11/2025 |
| 3.2.0 | 226 | 4/3/2025 |
| 3.1.1 | 213 | 3/30/2025 |
| 3.1.0 | 216 | 3/30/2025 |