Crate rustls_pin[][src]

crates.io version license: Apache 2.0 unsafe forbidden pipeline status

rustls-pin

Server certificate pinning with rustls.

Features

  • Make a TLS connection to a server
  • Check that the server is using an allowed certificate
  • forbid(unsafe_code)

Alternatives

Example

let mut stream = rustls_pin::connect_pinned(
    addr,
    vec![server_cert1, server_cert2],
).unwrap();

Happy Contributors 🙂

Fixing bugs and adding features is easy and fast. Send us a pull request and we intend to:

  • Always respond within 24 hours
  • Provide clear & concrete feedback
  • Immediately make a new release for your accepted change

Structs

PinnedServerCertVerifier

A struct for TLS clients to verify the server’s certificate. Implements certificate pinning. It accepts the server’s certificate if it is identical to any of the certificates in the struct.

Functions

arbitrary_dns_name

An arbitrary DNSName struct, for passing to rustls::ClientSession::new. PinnedServerCertVerifier receives the value and ignores it.

connect_pinned

Make a TCP connection to addr and set up a TLS session.