Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
R

rust-native-tls

> 编程语言
Open source

native-tls crate Documentation An abstraction over platform-specific TLS implementations. Specifically, this crate uses SChannel on Windows…

545 stars0 likes1 views
WebsiteGitHub

About

native-tls crate Documentation An abstraction over platform-specific TLS implementations. Specifically, this crate uses SChannel on Windows…

native-tls crate

Documentation

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.

Using platform-native TLS library can reduce binary sizes, compilation times, and improve compatibility with system-wide proxies and CA certificate stores.

Installation

cargo add native-tls or

toml
# Cargo.toml
[dependencies]
native-tls = "0.2"

Usage

An example client looks like:

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

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

    let stream = TcpStream::connect("google.com:443").unwrap();
    let mut stream = connector.connect("google.com", 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:

…

Supported features

This crate supports the following features out of the box:

  • TLS/SSL client communication
  • TLS/SSL server communication
  • PKCS#12 encoded identities
  • X.509/PKCS#8 encoded identities
  • Secure-by-default for client and server
    • Includes hostname verification for clients
  • Supports asynchronous I/O for both the server and the client

License

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.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rust

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言