A TLS connector for rustls modelled after the openssl and native-tls APIs.
Wraps rustls with a high-level RustlsConnector type that mirrors the
ergonomics of native_tls::TlsConnector, making it straightforward to swap
TLS backends in existing code. An async variant is available via the futures
feature.
Feature flags
Certificate store (pick at least one)
| Flag | Notes |
|---|---|
platform-verifier (default) |
Platform trust store via rustls-platform-verifier |
native-certs |
Native root certificates via rustls-native-certs |
webpki-root-certs |
Bundled Mozilla root certificate set |
Rustls crypto provider (at least one required)
| Flag | Notes |
|---|---|
rustls--aws_lc_rs (default) |
Uses aws-lc-rs |
rustls--ring |
Uses ring (more portable, e.g. builds on Windows) |
Miscellaneous
| Flag | Notes |
|---|---|
futures |
Async connect via futures-rustls |
logging |
Enable rustls TLS logging |
Example
To connect to a remote server:
use RustlsConnector;
use ;
let connector = new_with_platform_verifier.unwrap;
let stream = connect.unwrap;
let mut stream = connector.connect.unwrap;
stream.write_all.unwrap;
let mut res = vec!;
stream.read_to_end.unwrap;
println!;