Skip to content

Commit c97535a

Browse files
Fix deprecation warnings (#9)
1 parent c0b901d commit c97535a

3 files changed

Lines changed: 14 additions & 11 deletions

File tree

kmip/pie/sqltypes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ class EnumType(types.TypeDecorator):
8484
"""
8585

8686
impl = types.Integer
87+
cache_ok = False
8788

8889
def __init__(self, cls):
8990
"""

kmip/services/kmip_client.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -285,13 +285,14 @@ def open(self):
285285
six.reraise(*last_error)
286286

287287
def _create_socket(self, sock):
288-
self.socket = ssl.wrap_socket(
289-
sock,
288+
context = ssl.SSLContext(self.ssl_version)
289+
context.load_cert_chain(
290290
keyfile=self.keyfile,
291-
certfile=self.certfile,
292-
cert_reqs=self.cert_reqs,
293-
ssl_version=self.ssl_version,
294-
ca_certs=self.ca_certs,
291+
certfile=self.certfile)
292+
context.verify_mode = self.cert_reqs
293+
context.load_verify_locations(cafile=self.ca_certs)
294+
self.socket = context.wrap_socket(
295+
sock,
295296
do_handshake_on_connect=self.do_handshake_on_connect,
296297
suppress_ragged_eofs=self.suppress_ragged_eofs)
297298
self.socket.settimeout(self.timeout)

kmip/services/server/crypto/engine.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
from cryptography import exceptions as errors
2020
from cryptography.hazmat.backends import default_backend
21+
from cryptography.hazmat.decrepit.ciphers import algorithms as new_algorithms
2122
from cryptography.hazmat.primitives import serialization, hashes, hmac, cmac
2223
from cryptography.hazmat.primitives import padding as symmetric_padding
2324
from cryptography.hazmat.primitives.asymmetric import rsa
@@ -49,13 +50,13 @@ def __init__(self):
4950
# The IDEA algorithm is supported by cryptography but may not be
5051
# supported by certain backends, like OpenSSL.
5152
self._symmetric_key_algorithms = {
52-
enums.CryptographicAlgorithm.TRIPLE_DES: algorithms.TripleDES,
53+
enums.CryptographicAlgorithm.TRIPLE_DES: new_algorithms.TripleDES,
5354
enums.CryptographicAlgorithm.AES: algorithms.AES,
54-
enums.CryptographicAlgorithm.BLOWFISH: algorithms.Blowfish,
55+
enums.CryptographicAlgorithm.BLOWFISH: new_algorithms.Blowfish,
5556
enums.CryptographicAlgorithm.CAMELLIA: algorithms.Camellia,
56-
enums.CryptographicAlgorithm.CAST5: algorithms.CAST5,
57-
enums.CryptographicAlgorithm.IDEA: algorithms.IDEA,
58-
enums.CryptographicAlgorithm.RC4: algorithms.ARC4
57+
enums.CryptographicAlgorithm.CAST5: new_algorithms.CAST5,
58+
enums.CryptographicAlgorithm.IDEA: new_algorithms.IDEA,
59+
enums.CryptographicAlgorithm.RC4: new_algorithms.ARC4
5960
}
6061
self._asymmetric_key_algorithms = {
6162
enums.CryptographicAlgorithm.RSA: self._create_rsa_key_pair

0 commit comments

Comments
 (0)