Skip to content

Commit 8e42845

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 e861c7c commit 8e42845

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
@@ -316,8 +316,16 @@ pub enum Protocol {
316316
/// you are not sure if you need to enable this protocol, you should not.
317317
Sslv3,
318318
/// The TLS 1.0 protocol.
319+
///
320+
/// # Warning
321+
///
322+
/// Deprecated in 2021 (RFC 8996)
319323
Tlsv10,
320324
/// The TLS 1.1 protocol.
325+
///
326+
/// # Warning
327+
///
328+
/// Deprecated in 2021 (RFC 8996)
321329
Tlsv11,
322330
/// The TLS 1.2 protocol.
323331
Tlsv12,
@@ -350,7 +358,7 @@ impl TlsConnectorBuilder {
350358
///
351359
/// A value of `None` enables support for the oldest protocols supported by the implementation.
352360
///
353-
/// Defaults to `Some(Protocol::Tlsv10)`.
361+
/// Defaults to `Some(Protocol::Tlsv12)`.
354362
pub fn min_protocol_version(&mut self, protocol: Option<Protocol>) -> &mut TlsConnectorBuilder {
355363
self.min_protocol = protocol;
356364
self
@@ -476,7 +484,7 @@ impl TlsConnector {
476484
pub fn builder() -> TlsConnectorBuilder {
477485
TlsConnectorBuilder {
478486
identity: None,
479-
min_protocol: Some(Protocol::Tlsv10),
487+
min_protocol: Some(Protocol::Tlsv12),
480488
max_protocol: None,
481489
root_certificates: vec![],
482490
use_sni: true,
@@ -527,7 +535,7 @@ impl TlsAcceptorBuilder {
527535
///
528536
/// A value of `None` enables support for the oldest protocols supported by the implementation.
529537
///
530-
/// Defaults to `Some(Protocol::Tlsv10)`.
538+
/// Defaults to `Some(Protocol::Tlsv12)`.
531539
pub fn min_protocol_version(&mut self, protocol: Option<Protocol>) -> &mut TlsAcceptorBuilder {
532540
self.min_protocol = protocol;
533541
self
@@ -605,7 +613,7 @@ impl TlsAcceptor {
605613
pub fn builder(identity: Identity) -> TlsAcceptorBuilder {
606614
TlsAcceptorBuilder {
607615
identity,
608-
min_protocol: Some(Protocol::Tlsv10),
616+
min_protocol: Some(Protocol::Tlsv12),
609617
max_protocol: None,
610618
}
611619
}

0 commit comments

Comments
 (0)