Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A modern TLS library in Rust

License

Unknown and 3 other licenses found

Licenses found

Unknown
LICENSE
Apache-2.0
LICENSE-APACHE
ISC
LICENSE-ISC
MIT
LICENSE-MIT
NotificationsYou must be signed in to change notification settings

rustls/rustls

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Rustls is a modern TLS library written in Rust.

Status

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

We have aroadmap for our future plans. We also havebenchmarks toprevent performance regressions and to let you evaluate rustls on your target hardware.

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

Build StatusCoverage Status (codecov.io)DocumentationChatOpenSSF Best Practices

Changelog

The detailed list of changes in each release can be found athttps://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 orobsolete cryptography by default.

Rustls implements TLS1.2 and TLS1.3 for both clients and servers. Seethe fulllist of protocol features.

Platform support

While Rustls itself is platform independent, by default it usesaws-lc-rs for implementingthe cryptography in TLS. Seethe aws-lc-rs FAQ for more details of theplatform/architecture support constraints in aws-lc-rs.

ring is also available via thering crate feature: seethe supportedring target platforms.

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

Specifyingdefault-features = false when depending on rustls will remove the implicitdependency on aws-lc-rs.

Rustls requires Rust 1.71 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 primitivesthat Rustls uses. This may be appealing if you have specific platform, compliance or featurerequirements that aren't met by the default provider,aws-lc-rs.

Users that wish to customize the provider in use can do so when constructingClientConfigandServerConfig instances using thewith_crypto_provider method on the respective configbuilder types. See thecrypto::CryptoProvider documentation for more details.

Built-in providers

Rustls ships with two built-in providers controlled by associated crate features:

  • aws-lc-rs - enabled by default, available with theaws_lc_rs crate feature enabled.
  • ring - available with thering crate feature enabled.

See the documentation forcrypto::CryptoProvider for details on how providers areselected.

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 thecustom provider example.This example implements a minimal provider using parts of theRustCrypto ecosystem.

See theMaking a custom CryptoProvider section of the documentation for more informationon this topic.

Example code

Ourexamples directory contains demos that show how to handle I/O using thestream::Stream helper, as well as more complex asynchronous I/O usingmio.If you're already using Tokio for an async runtime you may prefer to usetokio-rustls instead of interacting with rustls directly.

Themio based examples are the most complete, and discussed below. Usersnew to Rustls may prefer to look at the simple client/server examples beforediving in to the more complex MIO examples.

Client example program

The MIO client example program is namedtlsclient-mio.

Some sample runs:

$ cargo run --bin tlsclient-mio -- --http mozilla-modern.badssl.comHTTP/1.1 200 OKServer: nginx/1.6.2 (Ubuntu)Date: Wed, 01 Jun 2016 18:44:00 GMTContent-Type: text/htmlContent-Length: 644(...)

or

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

Runcargo run --bin tlsclient-mio -- --help for more options.

Server example program

The MIO server example program is namedtlsserver-mio.

Here's a sample run; we start a TLS echo server, then connect to it withopenssl andtlsclient-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:8443depth=2 CN = ponytown RSA CAverify error:num=19:self signed certificate in certificate chainhello world^C$ echo hello world | cargo run --bin tlsclient-mio -- --cafile test-ca/rsa-2048/ca.cert --port 8443 localhosthello world^C

Runcargo 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-ISCrespectively. You may use this software under the terms of anyof these licenses, at your option.

Project Membership

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

Code of conduct

This project adopts theRust Code of Conduct.Please emailrustls-mod@googlegroups.com to report any instance of misconduct, or if youhave any comments or questions on the Code of Conduct.


[8]ページ先頭

©2009-2025 Movatter.jp