mirror of
https://github.com/certbot/certbot.git
synced 2026-07-30 18:04:31 +02:00
Update py cryptography to >=2.5.0 (#9110)
* Update py cryptography to >=2.5.0 * Review feedback
This commit is contained in:
@@ -14,6 +14,7 @@ from cryptography.exceptions import UnsupportedAlgorithm
|
||||
from cryptography.hazmat.backends import default_backend
|
||||
from cryptography.hazmat.primitives import hashes
|
||||
from cryptography.hazmat.primitives import serialization
|
||||
from cryptography.x509 import ocsp
|
||||
import pytz
|
||||
import requests
|
||||
|
||||
@@ -23,14 +24,6 @@ from certbot import util
|
||||
from certbot.compat.os import getenv
|
||||
from certbot.interfaces import RenewableCert # pylint: disable=unused-import
|
||||
|
||||
try:
|
||||
# Only cryptography>=2.5 has ocsp module
|
||||
# and signature_hash_algorithm attribute in OCSPResponse class
|
||||
from cryptography.x509 import ocsp # pylint: disable=ungrouped-imports
|
||||
getattr(ocsp.OCSPResponse, 'signature_hash_algorithm')
|
||||
except (ImportError, AttributeError): # pragma: no cover
|
||||
ocsp = None # type: ignore
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -40,7 +33,7 @@ class RevocationChecker:
|
||||
|
||||
def __init__(self, enforce_openssl_binary_usage: bool = False) -> None:
|
||||
self.broken = False
|
||||
self.use_openssl_binary = enforce_openssl_binary_usage or not ocsp
|
||||
self.use_openssl_binary = enforce_openssl_binary_usage
|
||||
|
||||
if self.use_openssl_binary:
|
||||
if not util.exe_exists("openssl"):
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ install_requires = [
|
||||
# in which we added 2.6 support (see #2243), so we relax the requirement.
|
||||
'ConfigArgParse>=0.9.3',
|
||||
'configobj>=5.0.6',
|
||||
'cryptography>=2.1.4',
|
||||
'cryptography>=2.5.0',
|
||||
'distro>=1.0.1',
|
||||
'josepy>=1.9.0',
|
||||
'parsedatetime>=2.4',
|
||||
|
||||
@@ -10,6 +10,7 @@ from cryptography.exceptions import InvalidSignature
|
||||
from cryptography.exceptions import UnsupportedAlgorithm
|
||||
from cryptography.hazmat.backends import default_backend
|
||||
from cryptography.hazmat.primitives import hashes
|
||||
from cryptography.x509 import ocsp as ocsp_lib
|
||||
import pytz
|
||||
|
||||
from certbot import errors
|
||||
@@ -21,15 +22,6 @@ except ImportError: # pragma: no cover
|
||||
from unittest import mock
|
||||
|
||||
|
||||
try:
|
||||
# Only cryptography>=2.5 has ocsp module
|
||||
# and signature_hash_algorithm attribute in OCSPResponse class
|
||||
from cryptography.x509 import ocsp as ocsp_lib # pylint: disable=import-error
|
||||
getattr(ocsp_lib.OCSPResponse, 'signature_hash_algorithm')
|
||||
except (ImportError, AttributeError): # pragma: no cover
|
||||
ocsp_lib = None # type: ignore
|
||||
|
||||
|
||||
out = """Missing = in header key=value
|
||||
ocsp: Use -help for summary.
|
||||
"""
|
||||
@@ -139,8 +131,6 @@ class OCSPTestOpenSSL(unittest.TestCase):
|
||||
self.assertEqual(mock_log.info.call_count, 1)
|
||||
|
||||
|
||||
@unittest.skipIf(not ocsp_lib,
|
||||
reason='This class tests functionalities available only on cryptography>=2.5.0')
|
||||
class OSCPTestCryptography(unittest.TestCase):
|
||||
"""
|
||||
OCSP revokation tests using Cryptography >= 2.4.0
|
||||
|
||||
Reference in New Issue
Block a user