Skip to content

Commit

Permalink
Set default minimum protocol to TLS 1.2
Browse files Browse the repository at this point in the history
TLS 1.0 (published 1999) and 1.1 (published 2006) have been deprecated
since 2021 ([RFC 8996](https://datatracker.ietf.org/doc/html/rfc8996))
and are no longer considered secure.
  • Loading branch information
Property404 committed Apr 2, 2024
1 parent 0b69ce6 commit 2f8d6ef
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,16 @@ pub enum Protocol {
/// you are not sure if you need to enable this protocol, you should not.
Sslv3,
/// The TLS 1.0 protocol.
///
/// # Warning
///
/// Deprecated in 2021 (RFC 8996)
Tlsv10,
/// The TLS 1.1 protocol.
///
/// # Warning
///
/// Deprecated in 2021 (RFC 8996)
Tlsv11,
/// The TLS 1.2 protocol.
Tlsv12,
Expand Down Expand Up @@ -368,7 +376,7 @@ impl TlsConnectorBuilder {
///
/// A value of `None` enables support for the oldest protocols supported by the implementation.
///
/// Defaults to `Some(Protocol::Tlsv10)`.
/// Defaults to `Some(Protocol::Tlsv12)`.
pub fn min_protocol_version(&mut self, protocol: Option<Protocol>) -> &mut TlsConnectorBuilder {
self.min_protocol = protocol;
self
Expand Down Expand Up @@ -494,7 +502,7 @@ impl TlsConnector {
pub fn builder() -> TlsConnectorBuilder {
TlsConnectorBuilder {
identity: None,
min_protocol: Some(Protocol::Tlsv10),
min_protocol: Some(Protocol::Tlsv12),
max_protocol: None,
root_certificates: vec![],
use_sni: true,
Expand Down Expand Up @@ -545,7 +553,7 @@ impl TlsAcceptorBuilder {
///
/// A value of `None` enables support for the oldest protocols supported by the implementation.
///
/// Defaults to `Some(Protocol::Tlsv10)`.
/// Defaults to `Some(Protocol::Tlsv12)`.
pub fn min_protocol_version(&mut self, protocol: Option<Protocol>) -> &mut TlsAcceptorBuilder {
self.min_protocol = protocol;
self
Expand Down Expand Up @@ -623,7 +631,7 @@ impl TlsAcceptor {
pub fn builder(identity: Identity) -> TlsAcceptorBuilder {
TlsAcceptorBuilder {
identity,
min_protocol: Some(Protocol::Tlsv10),
min_protocol: Some(Protocol::Tlsv12),
max_protocol: None,
}
}
Expand Down

0 comments on commit 2f8d6ef

Please sign in to comment.