tokio-rustls

Async TLS for the Tokio runtime

Latest version: 0.26.4 registry icon
Maintenance score
100
Safety score
94
Popularity score
82
Check your open source dependency risks. Get immediate insight about security, stability and licensing risks.
Security
  Vulnerabilities
Version Suggest Low Medium High Critical
0.26.4 0 0 0 0 0
0.26.3 0 0 0 0 0
0.26.2 0 0 0 0 0
0.26.1 0 0 0 0 0
0.26.0 0 0 0 0 0
0.25.0 0 0 0 0 0
0.24.1 0 0 0 0 0
0.24.0 0 0 0 0 0
0.23.4 0 0 0 0 0
0.23.3 0 0 0 0 0
0.23.2 0 0 0 0 0
0.23.1 0 0 0 0 0
0.23.0 0 0 0 0 0
0.22.0 0 0 0 0 0
0.21.1 0 0 0 0 0
0.21.0 0 0 0 0 0
0.20.0 0 0 0 0 0
0.15.0 0 0 0 0 0
0.14.1 0 0 0 0 0
0.14.0 0 0 0 0 0
0.13.1 0 0 0 0 0
0.13.0 0 0 1 0 0
0.12.3 0 0 0 1 0
0.12.2 0 0 1 0 0
0.12.1 0 0 1 0 0
0.12.0 0 0 1 0 0
0.10.3 0 0 0 1 0
0.10.2 0 0 0 1 0
0.10.1 0 0 0 1 0
0.10.0 0 0 0 1 0
0.9.4 0 0 0 1 0
0.9.3 0 0 0 1 0
0.9.2 0 0 0 1 0
0.9.1 0 0 0 1 0
0.9.0 0 0 0 1 0
0.8.1 0 0 0 1 0
0.8.0 0 0 0 1 0
0.7.2 0 0 0 1 0
0.7.1 0 0 0 1 0
0.7.0 0 0 0 1 0
0.6.0 0 0 0 1 0
0.5.0 0 0 0 1 0
0.4.0 0 0 0 1 0
0.3.1 0 0 0 1 0
0.3.0 0 0 0 1 0
0.2.4 0 0 0 1 0
0.2.3 0 0 0 1 0
0.2.2 0 0 0 1 0
0.2.1 0 0 0 1 0
0.2.0 0 0 0 1 0
0.1.7 0 0 0 1 0
0.1.6 0 0 0 1 0
0.1.5 0 0 0 1 0
0.1.4 0 0 0 1 0
0.1.3 0 0 0 1 0
0.1.2 0 0 0 1 0
0.1.1 0 0 0 1 0
0.1.0 0 0 0 1 0

Stability
Latest release:

0.26.4 - This version is safe to use because it has no known security vulnerabilities at this time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform

Licensing

Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.

MIT   -   MIT License

Not a wildcard

Not proprietary

OSI Compliant


Apache-2.0   -   Apache License 2.0

Not a wildcard

Not proprietary

OSI Compliant



tokio-rustls

github actions crates license license docs.rs

Asynchronous TLS/SSL streams for Tokio using Rustls.

Basic Structure of a Client

use rustls_pki_types::ServerName;
use std::sync::Arc;
use tokio::net::TcpStream;
use tokio_rustls::rustls::{ClientConfig, RootCertStore};
use tokio_rustls::TlsConnector;

// ...

let mut root_cert_store = RootCertStore::empty();
root_cert_store.extend(webpki_roots::TLS_SERVER_ROOTS.iter().cloned());
let config = ClientConfig::builder()
    .with_root_certificates(root_cert_store)
    .with_no_client_auth();
let connector = TlsConnector::from(Arc::new(config));
let dnsname = ServerName::try_from("www.rust-lang.org").unwrap();

let stream = TcpStream::connect(&addr).await?;
let mut stream = connector.connect(dnsname, stream).await?;

// ...

Client Example Program

See examples/client.rs. You can run it with:

cargo run --example client -- hsts.badssl.com

Server Example Program

See examples/server.rs. You can run it with:

cargo run --example server -- 127.0.0.1:8000 --cert certs/cert.pem --key certs/cert.key.pem

If you don't have a certificate and key, you can generate a random key and self-signed certificate for testing with:

cargo install --locked rustls-cert-gen
rustls-cert-gen --output certs/ --san localhost

License & Origin

This project is licensed under either of

at your option.

This started as a fork of tokio-tls.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in tokio-rustls by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.