Skip to content

Commit 2f8d6ef

Browse files
committed
Set default minimum protocol to TLS 1.2
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.
1 parent 0b69ce6 commit 2f8d6ef

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/lib.rs

+12-4
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,16 @@ pub enum Protocol {
334334
/// you are not sure if you need to enable this protocol, you should not.
335335
Sslv3,
336336
/// The TLS 1.0 protocol.
337+
///
338+
/// # Warning
339+
///
340+
/// Deprecated in 2021 (RFC 8996)
337341
Tlsv10,
338342
/// The TLS 1.1 protocol.
343+
///
344+
/// # Warning
345+
///
346+
/// Deprecated in 2021 (RFC 8996)
339347
Tlsv11,
340348
/// The TLS 1.2 protocol.
341349
Tlsv12,
@@ -368,7 +376,7 @@ impl TlsConnectorBuilder {
368376
///
369377
/// A value of `None` enables support for the oldest protocols supported by the implementation.
370378
///
371-
/// Defaults to `Some(Protocol::Tlsv10)`.
379+
/// Defaults to `Some(Protocol::Tlsv12)`.
372380
pub fn min_protocol_version(&mut self, protocol: Option<Protocol>) -> &mut TlsConnectorBuilder {
373381
self.min_protocol = protocol;
374382
self
@@ -494,7 +502,7 @@ impl TlsConnector {
494502
pub fn builder() -> TlsConnectorBuilder {
495503
TlsConnectorBuilder {
496504
identity: None,
497-
min_protocol: Some(Protocol::Tlsv10),
505+
min_protocol: Some(Protocol::Tlsv12),
498506
max_protocol: None,
499507
root_certificates: vec![],
500508
use_sni: true,
@@ -545,7 +553,7 @@ impl TlsAcceptorBuilder {
545553
///
546554
/// A value of `None` enables support for the oldest protocols supported by the implementation.
547555
///
548-
/// Defaults to `Some(Protocol::Tlsv10)`.
556+
/// Defaults to `Some(Protocol::Tlsv12)`.
549557
pub fn min_protocol_version(&mut self, protocol: Option<Protocol>) -> &mut TlsAcceptorBuilder {
550558
self.min_protocol = protocol;
551559
self
@@ -623,7 +631,7 @@ impl TlsAcceptor {
623631
pub fn builder(identity: Identity) -> TlsAcceptorBuilder {
624632
TlsAcceptorBuilder {
625633
identity,
626-
min_protocol: Some(Protocol::Tlsv10),
634+
min_protocol: Some(Protocol::Tlsv12),
627635
max_protocol: None,
628636
}
629637
}

0 commit comments

Comments
 (0)