net/quic: Allow SSL keylog file for debugging

rustls has a KeyLog implementation that opens a file whose name is
given by the `SSLKEYLOGFILE` environment variable, and writes keys
into it. If SSLKEYLOGFILE is not set, this does nothing.

See
https://docs.rs/rustls/latest/rustls/struct.KeyLogFile.html
https://docs.rs/rustls/latest/rustls/trait.KeyLog.html

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1036>
This commit is contained in:
Tamas Levai 2024-02-21 11:37:40 +01:00 committed by Sanchayan Maity
parent ce930eab5f
commit befd8d4bd2

View file

@ -144,6 +144,7 @@ fn configure_client(secure_conn: bool, alpns: Vec<String>) -> Result<ClientConfi
.map(|x| x.as_bytes().to_vec())
.collect::<Vec<_>>();
crypto.alpn_protocols = alpn_protocols;
crypto.key_log = Arc::new(rustls::KeyLogFile::new());
Ok(ClientConfig::new(Arc::new(crypto)))
}
@ -234,6 +235,7 @@ fn configure_server(
.map(|x| x.as_bytes().to_vec())
.collect::<Vec<_>>();
crypto.alpn_protocols = alpn_protocols;
crypto.key_log = Arc::new(rustls::KeyLogFile::new());
let mut server_config = ServerConfig::with_crypto(Arc::new(crypto));
Arc::get_mut(&mut server_config.transport)