~~NOTOC~~ ====== 10. Comunicazione TLS/mTLS ====== **Scenari:** 4 \\ **Funzioni FFI:** ~30 \\ **Stato:** Pianificato Questa categoria comprende tutti gli scenari per la comunicazione TLS sicura Post-Quantum. Setup del server, configurazione del client e deployment mTLS. ---- ===== Scenari ===== ^ ID ^ Scenario ^ Descrizione ^ Complessità ^ Stato ^ | [[.:server_setup|10.1]] | Configurare server TLS | Server con certificato PQ | Media | Pianificato | | [[.:client_config|10.2]] | Configurare client TLS | Client per PQ-TLS | Media | Pianificato | | [[.:mtls_deployment|10.3]] | Deployment mTLS | Autenticazione reciproca | Alta | Pianificato | | [[.:hybrid_tls|10.4]] | TLS ibrido | ECDHE + ML-KEM Key Exchange | Alta | Pianificato | ---- ===== TLS 1.3 con PQ Key Exchange ===== sequenceDiagram participant C as Client participant S as Server Note over C,S: TLS 1.3 Handshake con Hybrid Key Exchange C->>S: ClientHello (x25519_mlkem768) Note right of C: ECDH + ML-KEM Key Shares S->>C: ServerHello (x25519_mlkem768) S->>C: EncryptedExtensions S->>C: Certificate (ML-DSA-65) S->>C: CertificateVerify S->>C: Finished Note over C: Validare certificato Note over C: Calcolare chiave ibrida C->>S: Finished Note over C,S: Comunicazione crittografata ---- ===== Cipher Suites ===== ^ Cipher Suite ^ Key Exchange ^ Autenticazione ^ Crittografia ^ | TLS_AES_256_GCM_SHA384 | x25519_mlkem768 | ML-DSA-65 | AES-256-GCM | | TLS_CHACHA20_POLY1305_SHA256 | x25519_mlkem768 | ML-DSA-65 | ChaCha20-Poly1305 | | TLS_AES_256_GCM_SHA384 | x25519 (Hybrid fallback) | ECDSA P-384 | AES-256-GCM | ---- ===== Configurazione server ===== ^ Server ^ Configurazione ^ Supporto PQ ^ | **Nginx** | ssl_certificate + ssl_protocols | Via OpenSSL 3.6 | | **Apache** | SSLCertificateFile + SSLProtocol | Via OpenSSL 3.6 | | **Kestrel (.NET)** | HttpsConnectionAdapterOptions | Nativo | | **HAProxy** | bind ... ssl crt | Via OpenSSL 3.6 | ---- ===== Requisiti specifici per settore ===== ^ Settore ^ Requisito TLS ^ Particolarità ^ | **Energia/SCADA** | TLS 1.2+ | IEC 62351, Fallback offline | | **Sanità** | TLS 1.3 | gematik TI-Konnektor | | **Automotive** | TLS 1.3 | V2X, handshake brevi | | **Industria 4.0** | TLS 1.3 + mTLS | OPC UA Security | ---- ===== Guida rapida al codice ===== ==== Kestrel Server (ASP.NET Core) ==== // Program.cs var builder = WebApplication.CreateBuilder(args); builder.WebHost.ConfigureKestrel(options => { options.ListenAnyIP(443, listenOptions => { listenOptions.UseHttps(httpsOptions => { // Caricare certificato PQ var cert = ctx.LoadCertificate("server.crt.pem"); var key = ctx.LoadPrivateKey("server.key.pem", password); httpsOptions.ServerCertificate = ctx.CreateX509Certificate2(cert, key); // Forzare TLS 1.3 httpsOptions.SslProtocols = SslProtocols.Tls13; // Certificato client per mTLS httpsOptions.ClientCertificateMode = ClientCertificateMode.RequireCertificate; httpsOptions.ClientCertificateValidation = (cert, chain, errors) => { return ctx.ValidateCertificate(cert, trustStore).IsValid; }; }); }); }); ==== HttpClient con PQ-TLS ==== // Configurare HttpClient per PQ-TLS var handler = new SocketsHttpHandler { SslOptions = new SslClientAuthenticationOptions { EnabledSslProtocols = SslProtocols.Tls13, RemoteCertificateValidationCallback = (sender, cert, chain, errors) => { // Validazione certificato PQ return ctx.ValidateCertificate(cert, trustStore).IsValid; } } }; var httpClient = new HttpClient(handler); var response = await httpClient.GetAsync("https://pq-server.example.com/api/data"); ---- ===== Configurazione OpenSSL 3.6 ===== # /etc/ssl/openssl.cnf [openssl_init] providers = provider_sect [provider_sect] default = default_sect oqsprovider = oqsprovider_sect [default_sect] activate = 1 [oqsprovider_sect] activate = 1 module = /usr/lib/ossl-modules/oqsprovider.so ---- ===== Categorie correlate ===== ^ Categoria ^ Relazione ^ | [[it:int:pqcrypt:szenarien:zertifikate:start|3. Emettere certificati]] | Certificati server | | [[it:int:pqcrypt:szenarien:authentifizierung:start|9. Autenticazione]] | mTLS Client-Auth | | [[it:int:pqcrypt:szenarien:verschluesselung:start|7. Crittografia]] | Key Exchange | ---- << [[it:int:pqcrypt:szenarien:authentifizierung:start|← 9. Autenticazione]] | [[it:int:pqcrypt:szenarien:start|↑ Scenari]] | [[it:int:pqcrypt:szenarien:schluessel:start|11. Gestione chiavi →]] >> ---- //Wolfgang van der Stille @ EMSR DATA d.o.o. - Post-Quantum Cryptography Professional// {{tag>categoria tls mtls https openssl}}