From 2911bd7eca8217052a61d5bddb5d7c05dfb00614 Mon Sep 17 00:00:00 2001 From: Viktor Pashaiev Date: Tue, 1 Dec 2026 13:25:22 +0100 Subject: [PATCH] Replace removed ssl.PROTOCOL_TLSv1* with PROTOCOL_TLS_SERVER --- kmip/services/auth.py | 4 ++-- kmip/tests/unit/pie/test_client.py | 2 +- kmip/tests/unit/services/test_auth.py | 7 ++----- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/kmip/services/auth.py b/kmip/services/auth.py index a53af2974..9e3d53665 100644 --- a/kmip/services/auth.py +++ b/kmip/services/auth.py @@ -184,7 +184,7 @@ def __init__(self, cipher_suites=None): suites. Optional, defaults to None. """ super(BasicAuthenticationSuite, self).__init__(cipher_suites) - self._protocol = ssl.PROTOCOL_TLSv1 + self._protocol = ssl.PROTOCOL_TLS_SERVER class TLS12AuthenticationSuite(AuthenticationSuite): @@ -231,4 +231,4 @@ def __init__(self, cipher_suites=None): suites. Optional, defaults to None. """ super(TLS12AuthenticationSuite, self).__init__(cipher_suites) - self._protocol = ssl.PROTOCOL_TLSv1_2 + self._protocol = ssl.PROTOCOL_TLS_SERVER diff --git a/kmip/tests/unit/pie/test_client.py b/kmip/tests/unit/pie/test_client.py index 565d4f404..f8be99cc5 100644 --- a/kmip/tests/unit/pie/test_client.py +++ b/kmip/tests/unit/pie/test_client.py @@ -65,7 +65,7 @@ def test_init(self): cert='/example/path/to/cert', key='/example/path/to/key', ca='/example/path/to/ca', - ssl_version=ssl.PROTOCOL_TLSv1, + ssl_version=ssl.PROTOCOL_TLS_CLIENT, username='username', password='password', config='test') diff --git a/kmip/tests/unit/services/test_auth.py b/kmip/tests/unit/services/test_auth.py index 92ec1f275..f0623684b 100644 --- a/kmip/tests/unit/services/test_auth.py +++ b/kmip/tests/unit/services/test_auth.py @@ -13,7 +13,6 @@ # License for the specific language governing permissions and limitations # under the License. -import pytest import ssl import testtools @@ -39,7 +38,7 @@ def test_protocol(self): protocol = suite.protocol self.assertIsInstance(protocol, int) - self.assertEqual(ssl.PROTOCOL_TLSv1, suite.protocol) + self.assertEqual(ssl.PROTOCOL_TLS_SERVER, suite.protocol) def test_ciphers(self): suite = auth.BasicAuthenticationSuite() @@ -119,8 +118,6 @@ def test_custom_ciphers_empty(self): self.assertIn('DHE-RSA-AES256-SHA', suites) -@pytest.mark.skipif(not hasattr(ssl, 'PROTOCOL_TLSv1_2'), - reason="Requires ssl.PROTOCOL_TLSv1_2") class TestTLS12AuthenticationSuite(testtools.TestCase): """ A test suite for the TLS12AuthenticationSuite. @@ -140,7 +137,7 @@ def test_protocol(self): protocol = suite.protocol self.assertIsInstance(protocol, int) - self.assertEqual(ssl.PROTOCOL_TLSv1_2, suite.protocol) + self.assertEqual(ssl.PROTOCOL_TLS_SERVER, suite.protocol) def test_ciphers(self): suite = auth.TLS12AuthenticationSuite()