Package: python-pykmip
Version: 0.10.0-12
Severity: important
Tags: patch
User: [email protected]
Usertags: origin-ubuntu tenacious

Dear Maintainer,

When Python is built against OpenSSL 4 without legacy TLSv1 methods,
ssl.PROTOCOL_TLSv1 and ssl.PROTOCOL_TLSv1_2 are no longer exposed.
This causes 14 unit tests to fail with AttributeError in
kmip/services/auth.py (BasicAuthenticationSuite) and breaks
TLS12AuthenticationSuite at runtime.

The attached patch replaces ssl.PROTOCOL_TLSv1 and ssl.PROTOCOL_TLSv1_2
with ssl.PROTOCOL_TLS_SERVER in kmip/services/auth.py and updates the
unit tests.

Upstream PR: https://github.com/OpenKMIP/PyKMIP/pull/744
Ubuntu bug: https://bugs.launchpad.net/bugs/2178443
Description: Replace removed ssl.PROTOCOL_TLSv1* with PROTOCOL_TLS_SERVER
Author: Viktor Pashaiev <[email protected]>
Origin: upstream, https://github.com/OpenKMIP/PyKMIP/pull/744
Bug-Ubuntu: https://bugs.launchpad.net/bugs/2178443
Forwarded: https://github.com/OpenKMIP/PyKMIP/pull/744
Last-Update: 2026-12-01

diff --git a/kmip/services/auth.py b/kmip/services/auth.py
index a53af29..9e3d536 100644
--- a/kmip/services/auth.py
+++ b/kmip/services/auth.py
@@ -184,7 +184,7 @@ class BasicAuthenticationSuite(AuthenticationSuite):
                 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 @@ class TLS12AuthenticationSuite(AuthenticationSuite):
                 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 565d4f4..f8be99c 100644
--- a/kmip/tests/unit/pie/test_client.py
+++ b/kmip/tests/unit/pie/test_client.py
@@ -65,7 +65,7 @@ class TestProxyKmipClient(testtools.TestCase):
             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 92ec1f2..f062368 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 @@ class TestBasicAuthenticationSuite(testtools.TestCase):
         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 @@ class TestBasicAuthenticationSuite(testtools.TestCase):
         self.assertIn('DHE-RSA-AES256-SHA', suites)
 
 
[email protected](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 @@ class TestTLS12AuthenticationSuite(testtools.TestCase):
         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()

Reply via email to