rustls

A modern TLS library in Rust

Latest version: 0.23.16 registry icon
Maintenance score
100
Safety score
93
Popularity score
100
Check your open source dependency risks. Get immediate insight about security, stability and licensing risks.
Security
  Vulnerabilities
Version Suggest Low Medium High Critical
0.23.16 0 0 0 0 0
0.23.15 0 0 0 0 0
0.23.14 0 0 0 0 0
0.23.13 0 0 0 0 0
0.23.12 0 0 0 0 0
0.23.11 0 0 0 0 0
0.23.10 0 0 0 0 0
0.23.9 0 0 0 0 0
0.23.8 0 0 0 0 0
0.23.7 0 0 0 0 0
0.23.6 0 0 0 0 0
0.23.5 0 0 0 0 0
0.23.4 0 0 1 0 0
0.23.3 0 0 1 0 0
0.23.2 0 0 1 0 0
0.23.1 0 0 1 0 0
0.23.0 0 0 1 0 0
0.22.4 0 0 0 0 0
0.22.3 0 0 1 0 0
0.22.2 0 0 1 0 0
0.22.1 0 0 1 0 0
0.22.0 0 0 1 0 0
0.21.12 0 0 0 0 0
0.21.11 0 0 0 0 0
0.21.10 0 0 1 0 0
0.21.9 0 0 1 0 0
0.21.8 0 0 1 0 0
0.21.7 0 0 1 0 0
0.21.6 0 0 1 0 0
0.21.5 0 0 1 0 0
0.21.4 0 0 1 0 0
0.21.3 0 0 1 0 0
0.21.2 0 0 1 0 0
0.21.1 0 0 1 0 0
0.21.0 0 0 1 0 0
0.20.9 0 0 1 0 0
0.20.8 0 0 1 0 0
0.20.7 0 0 1 0 0
0.20.6 0 0 1 0 0
0.20.5 0 0 1 0 0
0.20.4 0 0 1 0 0
0.20.3 0 0 1 0 0
0.20.2 0 0 1 0 0
0.20.1 0 0 1 0 0
0.20.0 0 0 1 0 0
0.19.1 0 0 1 0 0
0.19.0 0 0 1 0 0
0.18.1 0 0 1 0 0
0.18.0 0 0 1 0 0
0.17.0 0 0 1 0 0
0.16.0 0 0 1 0 0
0.15.2 0 0 1 0 0
0.15.1 0 0 1 0 0
0.15.0 0 0 1 0 0
0.14.0 0 0 1 0 0
0.13.1 0 0 1 0 0
0.13.0 0 0 1 0 0
0.12.0 0 0 1 0 0
0.11.0 0 0 1 0 0
0.10.0 0 0 1 0 0
0.9.0 0 0 1 0 0
0.8.0 0 0 1 0 0
0.7.0 0 0 1 0 0
0.6.0 0 0 1 0 0
0.5.8 0 0 1 0 0
0.5.7 0 0 1 0 0
0.5.6 0 0 1 0 0
0.5.5 0 0 1 0 0
0.5.4 0 0 1 0 0
0.5.3 0 0 1 0 0
0.5.2 0 0 1 0 0
0.5.1 0 0 1 0 0
0.5.0 0 0 1 0 0
0.1.2 0 0 1 0 0
0.1.1 0 0 1 0 0
0.1.0 0 0 1 0 0

Stability
Latest release:

0.23.16 - This version is safe to use because it has no known security vulnerabilities at this time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform

Licensing

Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.

Apache-2.0   -   Apache License 2.0

Not a wildcard

Not proprietary

OSI Compliant


ISC   -   ISC License

Not a wildcard

Not proprietary

OSI Compliant


MIT   -   MIT License

Not a wildcard

Not proprietary

OSI Compliant



Rustls is a modern TLS library written in Rust.

Status

Rustls is used in production at many organizations and projects. We aim to maintain reasonable API surface stability but the API may evolve as we make changes to accommodate new features or performance improvements.

We have a roadmap for our future plans. We also have benchmarks to prevent performance regressions and to let you evaluate rustls on your target hardware.

If you'd like to help out, please see CONTRIBUTING.md.

Build Status Coverage Status (codecov.io) Documentation Chat OpenSSF Best Practices

Changelog

The detailed list of changes in each release can be found at https://github.com/rustls/rustls/releases.

Documentation

https://docs.rs/rustls/

Approach

Rustls is a TLS library that aims to provide a good level of cryptographic security, requires no configuration to achieve that security, and provides no unsafe features or obsolete cryptography by default.

Rustls implements TLS1.2 and TLS1.3 for both clients and servers. See the full list of protocol features.

Platform support

While Rustls itself is platform independent, by default it uses aws-lc-rs for implementing the cryptography in TLS. See the aws-lc-rs FAQ for more details of the platform/architecture support constraints in aws-lc-rs.

ring is also available via the ring crate feature: see the supported ring target platforms.

By providing a custom instance of the crypto::CryptoProvider struct, you can replace all cryptography dependencies of rustls. This is a route to being portable to a wider set of architectures and environments, or compliance requirements. See the crypto::CryptoProvider documentation for more details.

Specifying default-features = false when depending on rustls will remove the dependency on aws-lc-rs.

Rustls requires Rust 1.63 or later. It has an optional dependency on zlib-rs which requires 1.75 or later.

Cryptography providers

Since Rustls 0.22 it has been possible to choose the provider of the cryptographic primitives that Rustls uses. This may be appealing if you have specific platform, compliance or feature requirements that aren't met by the default provider, aws-lc-rs.

Users that wish to customize the provider in use can do so when constructing ClientConfig and ServerConfig instances using the with_crypto_provider method on the respective config builder types. See the crypto::CryptoProvider documentation for more details.

Built-in providers

Rustls ships with two built-in providers controlled with associated feature flags:

  • aws-lc-rs - enabled by default, available with the aws_lc_rs feature flag enabled.
  • ring - available with the ring feature flag enabled.

See the documentation for crypto::CryptoProvider for details on how providers are selected.

Third-party providers

The community has also started developing third-party providers for Rustls:

Custom provider

We also provide a simple example of writing your own provider in the custom-provider example. This example implements a minimal provider using parts of the RustCrypto ecosystem.

See the Making a custom CryptoProvider section of the documentation for more information on this topic.

Example code

Our examples directory contains demos that show how to handle I/O using the stream::Stream helper, as well as more complex asynchronous I/O using mio. If you're already using Tokio for an async runtime you may prefer to use tokio-rustls instead of interacting with rustls directly.

The mio based examples are the most complete, and discussed below. Users new to Rustls may prefer to look at the simple client/server examples before diving in to the more complex MIO examples.

Client example program

The MIO client example program is named tlsclient-mio.

Some sample runs:

$ cargo run --bin tlsclient-mio -- --http mozilla-modern.badssl.com
HTTP/1.1 200 OK
Server: nginx/1.6.2 (Ubuntu)
Date: Wed, 01 Jun 2016 18:44:00 GMT
Content-Type: text/html
Content-Length: 644
(...)

or

$ cargo run --bin tlsclient-mio -- --http expired.badssl.com
TLS error: InvalidCertificate(Expired)
Connection closed

Run cargo run --bin tlsclient-mio -- --help for more options.

Server example program

The MIO server example program is named tlsserver-mio.

Here's a sample run; we start a TLS echo server, then connect to it with openssl and tlsclient-mio:

$ cargo run --bin tlsserver-mio -- --certs test-ca/rsa-2048/end.fullchain --key test-ca/rsa-2048/end.key -p 8443 echo &
$ echo hello world | openssl s_client -ign_eof -quiet -connect localhost:8443
depth=2 CN = ponytown RSA CA
verify error:num=19:self signed certificate in certificate chain
hello world
^C
$ echo hello world | cargo run --bin tlsclient-mio -- --cafile test-ca/rsa-2048/ca.cert -p 8443 localhost
hello world
^C

Run cargo run --bin tlsserver-mio -- --help for more options.

License

Rustls is distributed under the following three licenses:

  • Apache License version 2.0.
  • MIT license.
  • ISC license.

These are included as LICENSE-APACHE, LICENSE-MIT and LICENSE-ISC respectively. You may use this software under the terms of any of these licenses, at your option.

Project Membership

  • Joe Birr-Pixton (@ctz, Project Founder - full-time funded by Prossimo)
  • Dirkjan Ochtman (@djc, Co-maintainer)
  • Daniel McCarney (@cpu, Co-maintainer - half-time funded by Prossimo)
  • Josh Aas (@bdaehlie, Project Management)

Code of conduct

This project adopts the Rust Code of Conduct. Please email rustls-mod@googlegroups.com to report any instance of misconduct, or if you have any comments or questions on the Code of Conduct.