summaryrefslogtreecommitdiffhomepage
path: root/paramiko/transport.py
diff options
context:
space:
mode:
Diffstat (limited to 'paramiko/transport.py')
-rw-r--r--paramiko/transport.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/paramiko/transport.py b/paramiko/transport.py
index 14a26333..bd938635 100644
--- a/paramiko/transport.py
+++ b/paramiko/transport.py
@@ -120,6 +120,20 @@ from paramiko.util import (
)
+# TripleDES is moving from `cryptography.hazmat.primitives.ciphers.algorithms`
+# in cryptography>=43.0.0 to `cryptography.hazmat.decrepit.ciphers.algorithms`
+# It will be removed from `cryptography.hazmat.primitives.ciphers.algorithms`
+# in cryptography==48.0.0.
+#
+# Source References:
+# - https://github.com/pyca/cryptography/commit/722a6393e61b3ac
+# - https://github.com/pyca/cryptography/pull/11407/files
+try:
+ from cryptography.hazmat.decrepit.ciphers.algorithms import TripleDES
+except ImportError:
+ from cryptography.hazmat.primitives.ciphers.algorithms import TripleDES
+
+
# for thread cleanup
_active_threads = []
@@ -255,7 +269,7 @@ class Transport(threading.Thread, ClosingContextManager):
"key-size": 32,
},
"3des-cbc": {
- "class": algorithms.TripleDES,
+ "class": TripleDES,
"mode": modes.CBC,
"block-size": 8,
"key-size": 24,