15
15
import pytest
16
16
17
17
from cryptography import x509
18
- from cryptography .hazmat .backends .openssl .backend import backend
19
18
from cryptography .hazmat .primitives import serialization
20
19
from cryptography .hazmat .primitives .asymmetric import rsa
21
20
@@ -1017,9 +1016,7 @@ def test_convert_from_cryptography_private_key(self):
1017
1016
"""
1018
1017
PKey.from_cryptography_key creates a proper private PKey.
1019
1018
"""
1020
- key = serialization .load_pem_private_key (
1021
- intermediate_key_pem , None , backend
1022
- )
1019
+ key = serialization .load_pem_private_key (intermediate_key_pem , None )
1023
1020
pkey = PKey .from_cryptography_key (key )
1024
1021
1025
1022
assert isinstance (pkey , PKey )
@@ -1031,7 +1028,7 @@ def test_convert_from_cryptography_public_key(self):
1031
1028
"""
1032
1029
PKey.from_cryptography_key creates a proper public PKey.
1033
1030
"""
1034
- key = serialization .load_pem_public_key (cleartextPublicKeyPEM , backend )
1031
+ key = serialization .load_pem_public_key (cleartextPublicKeyPEM )
1035
1032
pkey = PKey .from_cryptography_key (key )
1036
1033
1037
1034
assert isinstance (pkey , PKey )
@@ -1043,9 +1040,7 @@ def test_convert_from_cryptography_unsupported_type(self):
1043
1040
"""
1044
1041
PKey.from_cryptography_key raises TypeError with an unsupported type.
1045
1042
"""
1046
- key = serialization .load_pem_private_key (
1047
- ec_private_key_pem , None , backend
1048
- )
1043
+ key = serialization .load_pem_private_key (ec_private_key_pem , None )
1049
1044
with pytest .raises (TypeError ):
1050
1045
PKey .from_cryptography_key (key )
1051
1046
@@ -1699,9 +1694,7 @@ def test_verify_success(self):
1699
1694
assert request .verify (pkey )
1700
1695
1701
1696
def test_convert_from_cryptography (self ):
1702
- crypto_req = x509 .load_pem_x509_csr (
1703
- cleartextCertificateRequestPEM , backend
1704
- )
1697
+ crypto_req = x509 .load_pem_x509_csr (cleartextCertificateRequestPEM )
1705
1698
req = X509Req .from_cryptography (crypto_req )
1706
1699
assert isinstance (req , X509Req )
1707
1700
@@ -2217,9 +2210,7 @@ def test_sign_bad_pubkey_type(self):
2217
2210
cert .sign (object (), b"sha256" )
2218
2211
2219
2212
def test_convert_from_cryptography (self ):
2220
- crypto_cert = x509 .load_pem_x509_certificate (
2221
- intermediate_cert_pem , backend
2222
- )
2213
+ crypto_cert = x509 .load_pem_x509_certificate (intermediate_cert_pem )
2223
2214
cert = X509 .from_cryptography (crypto_cert )
2224
2215
2225
2216
assert isinstance (cert , X509 )
@@ -3561,7 +3552,7 @@ def test_export_pem(self):
3561
3552
dumped_crl = self ._get_crl ().export (
3562
3553
self .cert , self .pkey , days = 20 , digest = b"sha256"
3563
3554
)
3564
- crl = x509 .load_pem_x509_crl (dumped_crl , backend )
3555
+ crl = x509 .load_pem_x509_crl (dumped_crl )
3565
3556
revoked = crl .get_revoked_certificate_by_serial_number (0x03AB )
3566
3557
assert revoked is not None
3567
3558
assert crl .issuer == x509 .Name (
@@ -3588,7 +3579,7 @@ def test_export_der(self):
3588
3579
dumped_crl = self ._get_crl ().export (
3589
3580
self .cert , self .pkey , FILETYPE_ASN1 , digest = b"sha256"
3590
3581
)
3591
- crl = x509 .load_der_x509_crl (dumped_crl , backend )
3582
+ crl = x509 .load_der_x509_crl (dumped_crl )
3592
3583
revoked = crl .get_revoked_certificate_by_serial_number (0x03AB )
3593
3584
assert revoked is not None
3594
3585
assert crl .issuer == x509 .Name (
@@ -3857,7 +3848,7 @@ def test_verify_with_missing_crl(self):
3857
3848
assert err .value .certificate .get_subject ().CN == "intermediate-service"
3858
3849
3859
3850
def test_convert_from_cryptography (self ):
3860
- crypto_crl = x509 .load_pem_x509_crl (crlData , backend )
3851
+ crypto_crl = x509 .load_pem_x509_crl (crlData )
3861
3852
crl = CRL .from_cryptography (crypto_crl )
3862
3853
assert isinstance (crl , CRL )
3863
3854
0 commit comments