Skip to content

Commit 2cd48a2

Browse files
authored
Merge branch 'main' into address_deprecation
2 parents 0c8b3a1 + 52a2814 commit 2cd48a2

4 files changed

Lines changed: 8 additions & 4 deletions

File tree

‎azure-iot-device/azure/iot/device/common/http_transport.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def _create_ssl_context(self):
6969
This method creates the SSLContext object used to authenticate the connection. The generated context is used by the http_client and is necessary when authenticating using a self-signed X509 cert or trusted X509 cert
7070
"""
7171
logger.debug("creating a SSL context")
72-
ssl_context = ssl.SSLContext(protocol=ssl.PROTOCOL_TLSv1_2)
72+
ssl_context = ssl.SSLContext(protocol=ssl.PROTOCOL_TLS_CLIENT)
7373

7474
if self._server_verification_cert:
7575
ssl_context.load_verify_locations(cadata=self._server_verification_cert)

‎azure-iot-device/azure/iot/device/common/mqtt_transport.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ def _create_ssl_context(self):
321321
This method creates the SSLContext object used by Paho to authenticate the connection.
322322
"""
323323
logger.debug("creating a SSL context")
324-
ssl_context = ssl.SSLContext(protocol=ssl.PROTOCOL_TLSv1_2)
324+
ssl_context = ssl.SSLContext(protocol=ssl.PROTOCOL_TLS_CLIENT)
325325

326326
if self._server_verification_cert:
327327
logger.debug("configuring SSL context with custom server verification cert")

‎tests/unit/common/test_http_transport.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ def test_configures_tls_context(self, mocker):
105105
HTTPTransport(hostname=fake_hostname)
106106
# Verify correctness of TLS/SSL Context
107107
assert mock_ssl_context_constructor.call_count == 1
108-
assert mock_ssl_context_constructor.call_args == mocker.call(protocol=ssl.PROTOCOL_TLSv1_2)
108+
assert mock_ssl_context_constructor.call_args == mocker.call(
109+
protocol=ssl.PROTOCOL_TLS_CLIENT
110+
)
109111
assert mock_ssl_context.check_hostname is True
110112
assert mock_ssl_context.verify_mode == ssl.CERT_REQUIRED
111113

‎tests/unit/common/test_mqtt_transport.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,9 @@ def test_configures_tls_context(self, mocker):
267267

268268
# Verify correctness of TLS/SSL Context
269269
assert mock_ssl_context_constructor.call_count == 1
270-
assert mock_ssl_context_constructor.call_args == mocker.call(protocol=ssl.PROTOCOL_TLSv1_2)
270+
assert mock_ssl_context_constructor.call_args == mocker.call(
271+
protocol=ssl.PROTOCOL_TLS_CLIENT
272+
)
271273
assert mock_ssl_context.check_hostname is True
272274
assert mock_ssl_context.verify_mode == ssl.CERT_REQUIRED
273275

0 commit comments

Comments
 (0)