From 2a83dd32c898af3ac8d6cc4f7cb29d86bc832011 Mon Sep 17 00:00:00 2001 From: Igor Abdrakhimov Date: Mon, 8 Sep 2025 10:32:55 -0700 Subject: [PATCH] Expose min TLS version in MQTT5 builder --- include/aws/iot/Mqtt5Client.h | 9 +++++++++ source/iot/Mqtt5Client.cpp | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/include/aws/iot/Mqtt5Client.h b/include/aws/iot/Mqtt5Client.h index b78f12822..b523df483 100644 --- a/include/aws/iot/Mqtt5Client.h +++ b/include/aws/iot/Mqtt5Client.h @@ -298,6 +298,15 @@ namespace Aws */ Mqtt5ClientBuilder &WithCertificateAuthority(const Crt::ByteCursor &cert) noexcept; + /** + * Sets the minimum tls version that is acceptable for connection establishment + * + * @param minimumTlsVersion minimum tls version allowed in client connections + * + * @return this builder object + */ + Mqtt5ClientBuilder &WithMinimumTlsVersion(aws_tls_versions minimumTlsVersion) noexcept; + /** * Sets the tls cipher preference for the tls context options. * diff --git a/source/iot/Mqtt5Client.cpp b/source/iot/Mqtt5Client.cpp index 18fde4ec4..fb7691f67 100644 --- a/source/iot/Mqtt5Client.cpp +++ b/source/iot/Mqtt5Client.cpp @@ -346,6 +346,15 @@ namespace Aws return *this; } + Mqtt5ClientBuilder &Mqtt5ClientBuilder::WithMinimumTlsVersion(aws_tls_versions minimumTlsVersion) noexcept + { + if (m_tlsConnectionOptions) + { + m_tlsConnectionOptions->SetMinimumTlsVersion(minimumTlsVersion); + } + return *this; + } + Mqtt5ClientBuilder &Mqtt5ClientBuilder::WithTlsCipherPreference(aws_tls_cipher_pref cipherPref) noexcept { if (m_tlsConnectionOptions)