百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

rust-native-tls

> 编程语言
开源

native-tls crate 文档 一个对平台特定 TLS 实现的抽象。具体来说,此 crate 在 Windows 上使用 SChannel ...

545 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

native-tls crate 文档 一个对平台特定 TLS 实现的抽象。具体来说,此 crate 在 Windows 上使用 SChannel ...

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

# 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 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rust

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

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