Kurzreferenz
Kompakte Code-Beispiele für schnellen Einstieg. Für detaillierte Erklärungen siehe die verlinkten Szenarien.
PKI & Zertifikate
Signaturen
Schlüsselaustausch & Verschlüsselung
Import/Export
Schnellstart: Kompletter Workflow
using WvdS.System.Security.Cryptography;
using WvdS.System.Security.Cryptography.KeyExchange;
using WvdS.System.Security.Cryptography.Encryption;
// 1. Konfiguration
CryptoConfig.DefaultMode = CryptoMode.Hybrid;
// 2. Schlüsselaustausch
using var mlKem = MlKem.Create(MlKemParameterSet.MlKem768);
byte[] publicKey = mlKem.ExportPublicKey();
// Sender: Encapsulate
var encap = MlKem.Encapsulate(publicKey);
byte[] ciphertext = encap.Ciphertext;
byte[] senderSecret = encap.SharedSecret;
// Empfänger: Decapsulate
byte[] receiverSecret = mlKem.Decapsulate(ciphertext);
// 3. Schlüsselableitung
byte[] aesKey = KeyDerivationExtensions.DeriveKey(
receiverSecret,
outputLength: 32,
info: Encoding.UTF8.GetBytes("AES-256-GCM"));
// 4. Verschlüsselung
var aes = new Aes256Gcm(aesKey);
byte[] encrypted = aes.Encrypt(plaintext);
byte[] decrypted = aes.Decrypt(encrypted);
Weiterführend
Wolfgang van der Stille @ EMSR DATA d.o.o. - Post-Quantum Cryptography Professional