Extract the peer's leaf certificate DER bytes from a QUIC connection. Returns `None` if the peer did not present a certificate (insecure transport) or if the runtime-type downcast fails.
(conn: &quinn::Connection)
| 118 | /// Returns `None` if the peer did not present a certificate (insecure |
| 119 | /// transport) or if the runtime-type downcast fails. |
| 120 | fn peer_leaf_cert_der(conn: &quinn::Connection) -> Option<Vec<u8>> { |
| 121 | let identity = conn.peer_identity()?; |
| 122 | let certs: &Vec<CertificateDer<'static>> = identity.downcast_ref()?; |
| 123 | certs.first().map(|c| c.as_ref().to_vec()) |
| 124 | } |
| 125 | |
| 126 | /// Handle all bidi streams on a single connection. |
| 127 | /// |
no test coverage detected