diff --git a/kmip/pie/sqltypes.py b/kmip/pie/sqltypes.py index 6b27616a..a0c6bffd 100644 --- a/kmip/pie/sqltypes.py +++ b/kmip/pie/sqltypes.py @@ -84,6 +84,7 @@ class EnumType(types.TypeDecorator): """ impl = types.Integer + cache_ok = False def __init__(self, cls): """ diff --git a/kmip/services/kmip_client.py b/kmip/services/kmip_client.py index 7f72adf7..b88f2c65 100644 --- a/kmip/services/kmip_client.py +++ b/kmip/services/kmip_client.py @@ -285,13 +285,14 @@ def open(self): six.reraise(*last_error) def _create_socket(self, sock): - self.socket = ssl.wrap_socket( - sock, + context = ssl.SSLContext(self.ssl_version) + context.load_cert_chain( keyfile=self.keyfile, - certfile=self.certfile, - cert_reqs=self.cert_reqs, - ssl_version=self.ssl_version, - ca_certs=self.ca_certs, + certfile=self.certfile) + context.verify_mode = self.cert_reqs + context.load_verify_locations(cafile=self.ca_certs) + self.socket = context.wrap_socket( + sock, do_handshake_on_connect=self.do_handshake_on_connect, suppress_ragged_eofs=self.suppress_ragged_eofs) self.socket.settimeout(self.timeout) diff --git a/kmip/services/server/crypto/engine.py b/kmip/services/server/crypto/engine.py index f8727d4a..1ad55851 100644 --- a/kmip/services/server/crypto/engine.py +++ b/kmip/services/server/crypto/engine.py @@ -18,6 +18,7 @@ from cryptography import exceptions as errors from cryptography.hazmat.backends import default_backend +from cryptography.hazmat.decrepit.ciphers import algorithms as new_algorithms from cryptography.hazmat.primitives import serialization, hashes, hmac, cmac from cryptography.hazmat.primitives import padding as symmetric_padding from cryptography.hazmat.primitives.asymmetric import rsa @@ -49,13 +50,13 @@ def __init__(self): # The IDEA algorithm is supported by cryptography but may not be # supported by certain backends, like OpenSSL. self._symmetric_key_algorithms = { - enums.CryptographicAlgorithm.TRIPLE_DES: algorithms.TripleDES, + enums.CryptographicAlgorithm.TRIPLE_DES: new_algorithms.TripleDES, enums.CryptographicAlgorithm.AES: algorithms.AES, - enums.CryptographicAlgorithm.BLOWFISH: algorithms.Blowfish, + enums.CryptographicAlgorithm.BLOWFISH: new_algorithms.Blowfish, enums.CryptographicAlgorithm.CAMELLIA: algorithms.Camellia, - enums.CryptographicAlgorithm.CAST5: algorithms.CAST5, - enums.CryptographicAlgorithm.IDEA: algorithms.IDEA, - enums.CryptographicAlgorithm.RC4: algorithms.ARC4 + enums.CryptographicAlgorithm.CAST5: new_algorithms.CAST5, + enums.CryptographicAlgorithm.IDEA: new_algorithms.IDEA, + enums.CryptographicAlgorithm.RC4: new_algorithms.ARC4 } self._asymmetric_key_algorithms = { enums.CryptographicAlgorithm.RSA: self._create_rsa_key_pair