Skip to content

Commit

Permalink
add client auth to test
Browse files Browse the repository at this point in the history
  • Loading branch information
Goirad committed Jan 14, 2020
1 parent 1a6d7ba commit ab437ba
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand All @@ -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));
Expand Down

0 comments on commit ab437ba

Please sign in to comment.