Skip to content

Commit 9d1e8a4

Browse files
committed
Remove deprecated cryptography backend param
Signed-off-by: Ivan Kanakarakis <[email protected]>
1 parent f36b06a commit 9d1e8a4

File tree

4 files changed

+4
-11
lines changed

4 files changed

+4
-11
lines changed

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ scripts =
4848
tools/parse_xsd2.py
4949
python_requires = >=3.6, <4
5050
install_requires =
51-
cryptography >= 1.4
51+
cryptography >= 3.1
5252
defusedxml
5353
pyOpenSSL
5454
python-dateutil

src/saml2/cryptography/asymmetric.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
"""This module provides methods for asymmetric cryptography."""
22

3-
import cryptography.hazmat.backends as _backends
43
import cryptography.hazmat.primitives.asymmetric as _asymmetric
54
import cryptography.hazmat.primitives.hashes as _hashes
65
import cryptography.hazmat.primitives.serialization as _serialization
76

87

98
def load_pem_private_key(data, password):
109
"""Load RSA PEM certificate."""
11-
key = _serialization.load_pem_private_key(
12-
data, password, _backends.default_backend())
10+
key = _serialization.load_pem_private_key(data, password)
1311
return key
1412

1513

src/saml2/cryptography/pki.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
"""This module provides methods for PKI operations."""
22

3-
import cryptography.hazmat.backends as _backends
43
import cryptography.x509 as _x509
54

65

76
def load_pem_x509_certificate(data):
87
"""Load X.509 PEM certificate."""
9-
return _x509.load_pem_x509_certificate(data, _backends.default_backend())
8+
return _x509.load_pem_x509_certificate(data)

src/saml2/cryptography/symmetric.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from warnings import warn as _warn
1111

1212
import cryptography.fernet as _fernet
13-
import cryptography.hazmat.backends as _backends
1413
import cryptography.hazmat.primitives.ciphers as _ciphers
1514

1615
from .errors import SymmetricCryptographyError
@@ -158,10 +157,7 @@ def build_cipher(self, alg='aes_128_cbc'):
158157
except KeyError:
159158
raise Exception('Unsupported chaining mode: {}'.format(cmode))
160159

161-
cipher = _ciphers.Cipher(
162-
_ciphers.algorithms.AES(self.key),
163-
mode(iv),
164-
backend=_backends.default_backend())
160+
cipher = _ciphers.Cipher(_ciphers.algorithms.AES(self.key), mode(iv))
165161

166162
return cipher, iv
167163

0 commit comments

Comments
 (0)