From ab437baa8aaddabbf05a5894f36babf748eb8912 Mon Sep 17 00:00:00 2001 From: Dario Gonzalez Date: Tue, 14 Jan 2020 14:15:17 -0800 Subject: [PATCH] add client auth to test --- src/test.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/test.rs b/src/test.rs index 15b68b9c..46087525 100644 --- a/src/test.rs +++ b/src/test.rs @@ -383,6 +383,7 @@ mod tests { let cert = include_bytes!("../test/cert.pem"); let ident = Identity::from_pkcs8(cert, key).unwrap(); + let ident2 = ident.clone(); let builder = p!(TlsAcceptor::new(ident)); let listener = p!(TcpListener::bind("0.0.0.0:0")); @@ -404,6 +405,13 @@ mod tests { let socket = p!(TcpStream::connect(("localhost", port))); let mut builder = TlsConnector::builder(); + // FIXME + // This checks that we can successfully add a certificate on the client side. + // Unfortunately, we can not request client certificates through the API of this library, + // otherwise we could check in the server thread that + // socket.peer_certificate().unwrap().is_some() + builder.identity(ident2); + builder.add_root_certificate(root_ca); let builder = p!(builder.build()); let mut socket = p!(builder.connect("foobar.com", socket));