Rust Native Tls

Alternatives To Rust Native Tls
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Base Drafts1,556
a month ago4Shell
Internet-Drafts that make up the base QUIC specification
Rust Web31,2783046a month ago25February 06, 2022108mitRust
Ethereum JSON-RPC multi-transport client. Rust implementation of web3 library. ENS address: rust-web3.eth
6 days ago3mitGo
goben is a golang tool to measure TCP/UDP transport layer throughput between hosts.
Rust Native Tls3932,32843819 days ago18November 01, 202246apache-2.0Rust
Ocaml Tls278
a month ago16bsd-2-clauseOCaml
TLS in pure OCaml
2 years ago28September 18, 20211bsd-2-clauseGo
quiwi 🥝 - QUIC implementation in Go.
Mitigating Obsolete Tls183
2 years ago2otherPowerShell
Guidance for mitigating obsolete Transport Layer Security configurations. #nsacyber
Tls Parser72353 months ago18September 20, 20212apache-2.0Rust
TLS parser written in rust with nom
3 years ago2October 28, 2020mitGo
Protocol detecting server library
Go Ws Transport59118190a year ago37May 25, 20223otherGo
a websocket implementation of a go-libp2p transport
Alternatives To Rust Native Tls
Select To Compare

Alternative Project Comparisons



An abstraction over platform-specific TLS implementations.

Specifically, this crate uses SChannel on Windows (via the schannel crate), Secure Transport on macOS (via the security-framework crate), and OpenSSL (via the openssl crate) on all other platforms.


# Cargo.toml
native-tls = "0.2"


An example client looks like:

extern crate native_tls;

use native_tls::TlsConnector;
use std::io::{Read, Write};
use std::net::TcpStream;

fn main() {
    let connector = TlsConnector::new().unwrap();

    let stream = TcpStream::connect("").unwrap();
    let mut stream = connector.connect("", stream).unwrap();

    stream.write_all(b"GET / HTTP/1.0\r\n\r\n").unwrap();
    let mut res = vec![];
    stream.read_to_end(&mut res).unwrap();
    println!("{}", String::from_utf8_lossy(&res));

To accept connections as a server from remote clients:

extern crate native_tls;

use native_tls::{Identity, TlsAcceptor, TlsStream};
use std::fs::File;
use std::io::{Read};
use std::net::{TcpListener, TcpStream};
use std::sync::Arc;
use std::thread;

fn main() {
    let mut file = File::open("identity.pfx").unwrap();
    let mut identity = vec![];
    file.read_to_end(&mut identity).unwrap();
    let identity = Identity::from_pkcs12(&identity, "hunter2").unwrap();

    let acceptor = TlsAcceptor::new(identity).unwrap();
    let acceptor = Arc::new(acceptor);

    let listener = TcpListener::bind("").unwrap();

    fn handle_client(stream: TlsStream<TcpStream>) {
        // ...

    for stream in listener.incoming() {
        match stream {
            Ok(stream) => {
                let acceptor = acceptor.clone();
                thread::spawn(move || {
                    let stream = acceptor.accept(stream).unwrap();
            Err(e) => { /* connection failed */ }


rust-native-tls is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses.

See LICENSE-APACHE, and LICENSE-MIT for details.

Popular Transport Projects
Popular Tls Projects
Popular Networking Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.