Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
wolfcrypt-tls
Safe Rust TLS client and server backed by wolfSSL.
Published as the wolfssl crate (lib.name = "wolfssl").
Why
wolfSSL is a FIPS 140-3 validated TLS library used in billions of embedded and server deployments. This crate wraps it in an idiomatic Rust API:
- FIPS 140-3 — TLS with a validated crypto backend, required by some regulated environments (commercial license; contact wolfSSL)
- Small footprint — one dependency chain, no OpenSSL; works on embedded targets and servers alike
- Transport-agnostic — any
Read + Writetype is a valid transport;TcpStream,UnixStream, in-memory pipes, and custom types all work without adaptation
Usage
[]
= "0.2"
TLS client
use ;
use ;
use TcpStream;
let mut roots = new;
roots.add_pem;
let config = builder
.with_root_certificates
.with_no_client_auth
.build?;
let stream = connect?;
let mut tls = new?;
tls.write_all?;
let mut buf = ;
let n = tls.read?;
TLS server
use ;
use TcpListener;
let config = builder
.with_certificate_chain
.with_no_client_auth
.build?;
let acceptor = new;
let listener = bind?;
for stream in listener.incoming
Mutual TLS (mTLS)
// Server — require a client certificate
let config = builder
.with_certificate_chain
.with_client_auth
.build?;
// Client — present a certificate
let config = builder
.with_root_certificates
.with_client_auth
.build?;
Protocol version pinning
use ProtocolVersion;
let config = builder
.with_root_certificates
.with_no_client_auth
.with_protocol_versions
.build?;
How it works
wolfssl-src Compiles wolfSSL C source (cc crate)
│
wolfcrypt-sys bindgen FFI bindings
│
wolfcrypt-tls TlsClient / TlsServer / TlsAcceptor ← this crate
lib.name = "wolfssl"
TlsClientConfig and TlsServerConfig wrap WOLFSSL_CTX in an Arc-backed
RAII type. TlsClient and TlsServer wrap WOLFSSL session pointers and
implement Read + Write. The transport is wired through wolfSSL's custom IO
callback mechanism (wolfSSL_SSLSetIORecv / wolfSSL_SSLSetIOSend) rather
than a file descriptor, which is what makes any Read + Write type work as a
transport.
For async use, the config types expose new_session_with_io, a typed session
builder that wires the callbacks and returns an owned *mut WOLFSSL.
wolfcrypt-tls-tokio and wolfcrypt-tls-futures-io build their async layers
on top of this without duplicating any cert/key loading logic.
| Feature | Description |
|---|---|
vendored |
Compile wolfSSL from source (requires WOLFSSL_SRC or pkg-config) |
fips |
Enable the wolfSSL FIPS 140-3 code path (commercial license required) |
References
- wolfSSL documentation
- wolfcrypt-tls-tokio — tokio async layer
- wolfcrypt-tls-futures-io — futures-io async layer
- workspace README
Copyright
Copyright (C) 2006-2026 wolfSSL Inc.
License
GPL-3.0-only OR LicenseRef-wolfSSL-commercial.
The underlying wolfSSL C library is licensed under GPL-3.0-or-later with a commercial option available from wolfSSL Inc.