mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-05-08 14:22:56 +00:00
Remove support for cryptography < 3.4 (#878)
* Stop passing backend to cryptography. * Make public_bytes() fallback the default. * Remove compatibility code for older cryptography versions. * Require cryptography 3.4+. * Restrict to cryptography >= 3.4 in integration tests. * Remove Debian Bullseye from CI. It only supports cryptography 3.3. * Improve imports. * Remove no longer existing conditional.
This commit is contained in:
@@ -85,8 +85,6 @@ seealso:
|
||||
- module: community.crypto.x509_certificate
|
||||
- module: community.crypto.x509_certificate_pipe
|
||||
- module: community.crypto.x509_certificate_info
|
||||
requirements:
|
||||
- cryptography >= 1.6 if O(verify_cert_parsable=true)
|
||||
"""
|
||||
|
||||
EXAMPLES = r"""
|
||||
@@ -132,12 +130,11 @@ from ansible_collections.community.crypto.plugins.module_utils.io import (
|
||||
)
|
||||
|
||||
|
||||
MINIMAL_CRYPTOGRAPHY_VERSION = "1.6"
|
||||
MINIMAL_CRYPTOGRAPHY_VERSION = "3.4"
|
||||
|
||||
CRYPTOGRAPHY_IMP_ERR = None
|
||||
try:
|
||||
import cryptography # noqa: F401, pylint: disable=unused-import
|
||||
from cryptography.hazmat.backends import default_backend
|
||||
from cryptography.x509 import load_der_x509_certificate
|
||||
except ImportError:
|
||||
CRYPTOGRAPHY_IMP_ERR = traceback.format_exc()
|
||||
@@ -234,7 +231,7 @@ class X509CertificateConvertModule(OpenSSLObject):
|
||||
exception=CRYPTOGRAPHY_IMP_ERR,
|
||||
)
|
||||
try:
|
||||
load_der_x509_certificate(self.input, default_backend())
|
||||
load_der_x509_certificate(self.input)
|
||||
except Exception as exc:
|
||||
module.fail_json(msg=f"Error while parsing certificate: {exc}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user