Skip to content

Provide an example on how to use rustls::server::Acceptor #97

@markandpathak

Description

@markandpathak

Hello,

I am new to both Rust and async in Rust with tokio so there might be something I might have missed or don't know. Rustls recommends here to use rustls::server::Acceptor for retrieving server certificates dynamically based on ClientHello when working in async manner. But I could not find any useful information on how to use that with Tokio-rustls.

What I have observed is Acceptor implements read_tls method which accepts a parameter which implements Read trait. But tokio::net::TcpStream implements AsyncRead which is not compatible to be passed in Acceptor. Or may be I don't know how to use that.

Any guidance or minimal example is appreciated on how to use Acceptor.

If there are any better ways to implement dynamic server certificates fetched from a key store, I would like to know that too.

PS: I need TCP socket stream directly as I am implementing a Pub/Sub Broker both for experimentation and learning Rust for real use case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions