What the Server Sees After mTLS
After a successful mTLS handshake, the server can inspect the client cert:
let tls_stream = acceptor.accept(tcp_stream).await?;
let (_, server_conn) = tls_stream.get_ref();
if let Some(certs) = server_conn.peer_certificates() {
let (_, client_cert) = X509Certificate::from_der(certs[0].as_ref())?;
let identity = client_cert.subject().to_string();
println!("Authenticated client: {}", identity);
}
This is how your provisioning service would extract the device identity from the client cert.