plumb export_keying_material from quinn-proto to quinn
@@ -438,6 +438,33 @@ where
}
}
+impl<S> Connection<S>
+where
+ S: proto::crypto::ExportKeyingMaterial,
+{
+ /// Derive keying material from this connection's TLS session secrets.
+ ///
+ /// When both peers call this method with the same `label` and `context`
+ /// arguments and `output` buffers of equal length, they will get the
+ /// same sequence of bytes in `output`. These bytes are cryptographically
+ /// strong and pseudorandom, and are suitable for use as keying material.
+ ///
+ /// See [RFC5705](https://tools.ietf.org/html/rfc5705) for more information.
+ pub fn export_keying_material(
+ &self,
+ output: &mut [u8],
+ label: &[u8],
+ context: Option<&[u8]>,
+ ) -> Result<(), <S as proto::crypto::ExportKeyingMaterial>::Error> {
+ self.0
+ .lock()
+ .unwrap()
+ .inner
+ .crypto_session()
+ .export_keying_material(output, label, context)
+ }
+}
+
impl<S> Clone for Connection<S>
where
S: proto::crypto::Session,
