Skip to content

Commit 6291429

Browse files
author
Spike
committed
ae.net.ssl.schannel: Add Windows SChannel TLS backend
Implements the full SChannel/SSPI-based TLS backend for ae.net.ssl, matching the cross-platform SSLContext API introduced in previous commits. Key design decisions and technical notes: - Entire module body guarded by `version (Windows):` so the file compiles to an empty translation unit on Linux/macOS with no changes needed. - Uses SCH_CREDENTIALS (Win10 1809+) with TLS_PARAMETERS deny-list for protocol version control, instead of legacy SCHANNEL_CRED. - PFX import uses the "perphemeral" pattern (dwFlags=0 + key container deletion on teardown via NCryptDeleteKey / CryptAcquireContextW), mirroring .NET's SafeCertContextHandleWithKeyContainerDeletion. PKCS12_NO_PERSIST_KEY is intentionally not used: LSASS cannot dereference an in-process NCRYPT_KEY_HANDLE across the process boundary required for server credentials. - DecryptMessage SEC_I_RENEGOTIATE handling is load-bearing for TLS 1.3: Windows sends two NewSessionTicket messages post-handshake, causing every TLS 1.3 server connection to fail if this path is not implemented. - ApplyControlToken is redeclared locally without A/W suffix to work around a druntime bug (secur32.dll exports only the unsuffixed symbol). - Includes bindings supplement for symbols missing from druntime 2.111: SP_PROT_TLS1_1/1.2/1.3, SCH_CREDENTIALS struct family, PFXImportCertStore, CertEnumCertificatesInStore, CertDuplicateCertificateContext, CertGetCertificateContextProperty, CryptStringToBinaryA, ncrypt functions. - Convenience methods setCertificateContext() and setCredentialsFromSystemStore() for Windows certificate store integration (non-portable, SChannel-specific). - Unittests: PFX echo server (pre-baked 2555-byte fixture, CN=localhost) and cross-backend corpus via testSSL(), both gated on debug(ae_unittest).
1 parent fb181a0 commit 6291429

1 file changed

Lines changed: 1419 additions & 0 deletions

File tree

0 commit comments

Comments
 (0)