====== Namespace KeyDerivation ======
**Namespace:** ''WvdS.System.Security.Cryptography.KeyDerivation''
Contiene classi per la derivazione delle chiavi (KDF) con supporto PQ.
----
===== Classi =====
^ Classe ^ Descrizione ^
| KeyDerivationExtensions | Funzioni KDF (HKDF, PBKDF2, Argon2id) |
| HybridKeyMaterial | Container per chiavi derivate |
| TlsKeyMaterial | Materiale chiavi stile TLS |
| Tls13KeySchedule | Key Schedule TLS 1.3 |
----
===== KDF supportate =====
^ Funzione ^ Standard ^ Utilizzo ^
| HKDF | RFC 5869((RFC 5869: https://datatracker.ietf.org/doc/html/rfc5869)) | Chiavi di sessione da Shared Secret |
| PBKDF2 | RFC 8018((RFC 8018: https://datatracker.ietf.org/doc/html/rfc8018)) | Chiavi basate su password |
| Argon2id | RFC 9106((RFC 9106: https://datatracker.ietf.org/doc/html/rfc9106)) | KDF memory-hard |
----
===== Esempio =====
using WvdS.System.Security.Cryptography.KeyDerivation;
byte[] sharedSecret = /* da ML-KEM */;
byte[] salt = RandomNumberGenerator.GetBytes(32);
// HKDF per chiavi di sessione
byte[] aesKey = KeyDerivationExtensions.DeriveKey(
sharedSecret,
outputLength: 32,
salt: salt,
info: Encoding.UTF8.GetBytes("AES-256-GCM"));
// Derivazione chiavi ibrida
byte[] hybridKey = KeyDerivationExtensions.DeriveHybridKey(
classicSecret: ecdhSecret,
pqSecret: mlKemSecret,
outputLength: 32);
----
===== Metodi principali =====
==== HKDF ====
^ Metodo ^ Descrizione ^
| ''DeriveKey'' | HKDF-Extract-then-Expand |
| ''HkdfExtract'' | Estrae PRK da IKM |
| ''HkdfExpand'' | Espande PRK in Output Key |
==== Hybrid ====
^ Metodo ^ Descrizione ^
| ''DeriveHybridKey'' | Combina secret classici + PQ |
| ''DeriveHybridKeyMaterial'' | Deriva chiavi multiple |
==== Basato su password ====
^ Metodo ^ Descrizione ^
| ''Pbkdf2'' | PBKDF2 standard con entropy PQ opzionale |
| ''Pbkdf2WithPqSalt'' | PBKDF2 con salt rafforzato PQ |
| ''Argon2id'' | KDF memory-hard via OpenSSL 3.6 |
==== TLS ====
^ Metodo ^ Descrizione ^
| ''DeriveTlsKeys'' | Key Material stile TLS 1.2 |
| ''DeriveTls13Keys'' | Key Schedule TLS 1.3 |
----
===== Parametri Argon2id raccomandati =====
^ Applicazione ^ Iterations (t) ^ Memory (m) ^ Parallelism (p) ^
| Hashing password | 3 | 64 MB | 4 |
| Alta sicurezza | 4 | 256 MB | 4 |
| Low-Memory | 4 | 16 MB | 4 |
----
===== Nota sulla sicurezza =====
**Sicurezza modalita Hybrid:**
In modalita Hybrid, la chiave finale viene compromessa solo se ENTRAMBI i secret (classico E PQ) vengono violati. Questo fornisce protezione sia contro attacchi classici che quantistici.
----
===== Vedi anche =====
* [[.:keyexchange|Namespace KeyExchange]]
* [[.:encryption|Namespace Encryption]]
* [[.:start|Panoramica API]]
{{tag>namespace kdf hkdf pbkdf2 argon2id}}
----
//Wolfgang van der Stille @ EMSR DATA d.o.o. - Post-Quantum Cryptography Professional//