native-tls crate
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
[]
= "0.2"
Usage
An example client looks like:
use TlsConnector;
use ;
use TcpStream;
To accept connections as a server from remote clients:
use ;
use File;
use ;
use ;
use Arc;
use thread;
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.