mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-05-06 21:33:00 +00:00
Re-sort imports.
This commit is contained in:
@@ -12,7 +12,6 @@ import re
|
||||
|
||||
from ansible.module_utils.common.text.converters import to_bytes
|
||||
|
||||
|
||||
# An ASN.1 serialized as a string in the OpenSSL format:
|
||||
# [modifier,]type[:value]
|
||||
#
|
||||
@@ -173,4 +172,4 @@ def pack_asn1(
|
||||
return bytes(b_asn1_data) + b_data
|
||||
|
||||
|
||||
__all__ = ("TagClass", "TagNumber", "serialize_asn1_string_as_der", "pack_asn1")
|
||||
__all__ = ("TagClass", "TagNumber", "pack_asn1", "serialize_asn1_string_as_der")
|
||||
|
||||
@@ -33,7 +33,6 @@ from __future__ import annotations
|
||||
|
||||
import typing as t
|
||||
|
||||
|
||||
# WARNING: this function no longer works with cryptography 35.0.0 and newer!
|
||||
# It must **ONLY** be used in compatibility code for older
|
||||
# cryptography versions!
|
||||
|
||||
@@ -11,7 +11,6 @@ from ansible_collections.community.crypto.plugins.module_utils._crypto._objects_
|
||||
OID_MAP,
|
||||
)
|
||||
|
||||
|
||||
OID_LOOKUP: dict[str, str] = {}
|
||||
NORMALIZE_NAMES: dict[str, str] = {}
|
||||
NORMALIZE_NAMES_SHORT: dict[str, str] = {}
|
||||
@@ -35,4 +34,4 @@ for alias, original in [("userID", "userId")]:
|
||||
OID_LOOKUP[alias] = OID_LOOKUP[original]
|
||||
|
||||
|
||||
__all__ = ("OID_LOOKUP", "NORMALIZE_NAMES", "NORMALIZE_NAMES_SHORT")
|
||||
__all__ = ("NORMALIZE_NAMES", "NORMALIZE_NAMES_SHORT", "OID_LOOKUP")
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
OID_MAP = {
|
||||
"0": ("itu-t", "ITU-T", "ccitt"),
|
||||
"0.3.4401.5": ("ntt-ds",),
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
try:
|
||||
import cryptography # noqa: F401, pylint: disable=unused-import
|
||||
|
||||
@@ -26,4 +25,4 @@ class OpenSSLBadPassphraseError(OpenSSLObjectError):
|
||||
pass
|
||||
|
||||
|
||||
__all__ = ("HAS_CRYPTOGRAPHY", "OpenSSLObjectError", "OpenSSLBadPassphraseError")
|
||||
__all__ = ("HAS_CRYPTOGRAPHY", "OpenSSLBadPassphraseError", "OpenSSLObjectError")
|
||||
|
||||
@@ -13,7 +13,6 @@ from ansible_collections.community.crypto.plugins.module_utils._version import (
|
||||
LooseVersion as _LooseVersion,
|
||||
)
|
||||
|
||||
|
||||
try:
|
||||
import cryptography
|
||||
from cryptography import x509
|
||||
@@ -32,7 +31,6 @@ from ansible_collections.community.crypto.plugins.module_utils._crypto.cryptogra
|
||||
cryptography_decode_name,
|
||||
)
|
||||
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
import datetime # pragma: no cover
|
||||
|
||||
@@ -200,11 +198,11 @@ __all__ = (
|
||||
"cryptography_decode_revoked_certificate",
|
||||
"cryptography_dump_revoked",
|
||||
"cryptography_get_signature_algorithm_oid_from_crl",
|
||||
"get_next_update",
|
||||
"get_last_update",
|
||||
"get_revocation_date",
|
||||
"get_invalidity_date",
|
||||
"set_next_update",
|
||||
"get_last_update",
|
||||
"get_next_update",
|
||||
"get_revocation_date",
|
||||
"set_last_update",
|
||||
"set_next_update",
|
||||
"set_revocation_date",
|
||||
)
|
||||
|
||||
@@ -28,7 +28,6 @@ from ansible_collections.community.crypto.plugins.module_utils._version import (
|
||||
LooseVersion,
|
||||
)
|
||||
|
||||
|
||||
try:
|
||||
import cryptography
|
||||
from cryptography import x509
|
||||
@@ -86,7 +85,6 @@ from ansible_collections.community.crypto.plugins.module_utils._crypto.basic imp
|
||||
OpenSSLObjectError,
|
||||
)
|
||||
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
import datetime # pragma: no cover
|
||||
|
||||
@@ -1108,27 +1106,27 @@ def is_potential_certificate_issuer_public_key(
|
||||
|
||||
__all__ = (
|
||||
"CRYPTOGRAPHY_TIMEZONE",
|
||||
"cryptography_compare_private_keys",
|
||||
"cryptography_compare_public_keys",
|
||||
"cryptography_decode_name",
|
||||
"cryptography_get_basic_constraints",
|
||||
"cryptography_get_extensions_from_cert",
|
||||
"cryptography_get_extensions_from_csr",
|
||||
"cryptography_get_name",
|
||||
"cryptography_key_needs_digest_for_signing",
|
||||
"cryptography_name_to_oid",
|
||||
"cryptography_oid_to_name",
|
||||
"cryptography_parse_relative_distinguished_name",
|
||||
"cryptography_get_name",
|
||||
"cryptography_decode_name",
|
||||
"cryptography_parse_key_usage_params",
|
||||
"cryptography_get_basic_constraints",
|
||||
"cryptography_key_needs_digest_for_signing",
|
||||
"cryptography_compare_public_keys",
|
||||
"cryptography_compare_private_keys",
|
||||
"parse_pkcs12",
|
||||
"cryptography_verify_signature",
|
||||
"cryptography_parse_relative_distinguished_name",
|
||||
"cryptography_verify_certificate_signature",
|
||||
"cryptography_verify_signature",
|
||||
"get_not_valid_after",
|
||||
"get_not_valid_before",
|
||||
"is_potential_certificate_issuer_private_key",
|
||||
"is_potential_certificate_issuer_public_key",
|
||||
"is_potential_certificate_private_key",
|
||||
"is_potential_certificate_public_key",
|
||||
"parse_pkcs12",
|
||||
"set_not_valid_after",
|
||||
"set_not_valid_before",
|
||||
"is_potential_certificate_private_key",
|
||||
"is_potential_certificate_issuer_private_key",
|
||||
"is_potential_certificate_public_key",
|
||||
"is_potential_certificate_issuer_public_key",
|
||||
)
|
||||
|
||||
@@ -160,11 +160,11 @@ def convert_bytes_to_int(data: bytes) -> int:
|
||||
|
||||
__all__ = (
|
||||
"binary_exp_mod",
|
||||
"simple_gcd",
|
||||
"quick_is_not_prime",
|
||||
"count_bytes",
|
||||
"count_bits",
|
||||
"convert_bytes_to_int",
|
||||
"convert_int_to_bytes",
|
||||
"convert_int_to_hex",
|
||||
"convert_bytes_to_int",
|
||||
"count_bits",
|
||||
"count_bytes",
|
||||
"quick_is_not_prime",
|
||||
"simple_gcd",
|
||||
)
|
||||
|
||||
@@ -36,7 +36,6 @@ from ansible_collections.community.crypto.plugins.module_utils._cryptography_dep
|
||||
assert_required_cryptography_version,
|
||||
)
|
||||
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
import datetime # pragma: no cover
|
||||
|
||||
@@ -416,8 +415,8 @@ def get_certificate_argument_spec() -> ArgumentSpec:
|
||||
|
||||
|
||||
__all__ = (
|
||||
"CertificateError",
|
||||
"CertificateBackend",
|
||||
"CertificateError",
|
||||
"CertificateProvider",
|
||||
"get_certificate_argument_spec",
|
||||
)
|
||||
|
||||
@@ -21,7 +21,6 @@ from ansible_collections.community.crypto.plugins.module_utils._crypto.module_ba
|
||||
CertificateProvider,
|
||||
)
|
||||
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
from ansible.module_utils.basic import AnsibleModule # pragma: no cover
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ from ansible_collections.community.crypto.plugins.module_utils._time import (
|
||||
get_now_datetime,
|
||||
)
|
||||
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
import datetime # pragma: no cover
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@ from ansible_collections.community.crypto.plugins.module_utils._time import (
|
||||
get_relative_time_option,
|
||||
)
|
||||
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
import datetime # pragma: no cover
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ from ansible_collections.community.crypto.plugins.module_utils._time import (
|
||||
get_relative_time_option,
|
||||
)
|
||||
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
import datetime # pragma: no cover
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ from ansible_collections.community.crypto.plugins.module_utils._cryptography_dep
|
||||
assert_required_cryptography_version,
|
||||
)
|
||||
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
from ansible.module_utils.basic import AnsibleModule # pragma: no cover
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ from ansible_collections.community.crypto.plugins.module_utils._cryptography_dep
|
||||
assert_required_cryptography_version,
|
||||
)
|
||||
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
from ansible.module_utils.basic import AnsibleModule # pragma: no cover
|
||||
from cryptography.hazmat.primitives.asymmetric.types import ( # pragma: no cover
|
||||
@@ -926,8 +925,8 @@ def get_csr_argument_spec() -> ArgumentSpec:
|
||||
|
||||
|
||||
__all__ = (
|
||||
"CertificateSigningRequestError",
|
||||
"CertificateSigningRequestBackend",
|
||||
"select_backend",
|
||||
"CertificateSigningRequestError",
|
||||
"get_csr_argument_spec",
|
||||
"select_backend",
|
||||
)
|
||||
|
||||
@@ -30,7 +30,6 @@ from ansible_collections.community.crypto.plugins.module_utils._cryptography_dep
|
||||
assert_required_cryptography_version,
|
||||
)
|
||||
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
from ansible.module_utils.basic import AnsibleModule # pragma: no cover
|
||||
from cryptography.hazmat.primitives.asymmetric.types import ( # pragma: no cover
|
||||
|
||||
@@ -36,7 +36,6 @@ from ansible_collections.community.crypto.plugins.module_utils._cryptography_dep
|
||||
assert_required_cryptography_version,
|
||||
)
|
||||
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
from ansible.module_utils.basic import AnsibleModule # pragma: no cover
|
||||
from cryptography.hazmat.primitives.asymmetric.types import ( # pragma: no cover
|
||||
@@ -655,8 +654,8 @@ def get_privatekey_argument_spec() -> ArgumentSpec:
|
||||
|
||||
|
||||
__all__ = (
|
||||
"PrivateKeyError",
|
||||
"PrivateKeyBackend",
|
||||
"select_backend",
|
||||
"PrivateKeyError",
|
||||
"get_privatekey_argument_spec",
|
||||
"select_backend",
|
||||
)
|
||||
|
||||
@@ -30,7 +30,6 @@ from ansible_collections.community.crypto.plugins.module_utils._cryptography_dep
|
||||
)
|
||||
from ansible_collections.community.crypto.plugins.module_utils._io import load_file
|
||||
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
from ansible.module_utils.basic import AnsibleModule # pragma: no cover
|
||||
from cryptography.hazmat.primitives.asymmetric.types import ( # pragma: no cover
|
||||
@@ -287,8 +286,8 @@ def get_privatekey_argument_spec() -> ArgumentSpec:
|
||||
|
||||
|
||||
__all__ = (
|
||||
"PrivateKeyError",
|
||||
"PrivateKeyConvertBackend",
|
||||
"select_backend",
|
||||
"PrivateKeyError",
|
||||
"get_privatekey_argument_spec",
|
||||
"select_backend",
|
||||
)
|
||||
|
||||
@@ -33,7 +33,6 @@ from ansible_collections.community.crypto.plugins.module_utils._cryptography_dep
|
||||
assert_required_cryptography_version,
|
||||
)
|
||||
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
from ansible.module_utils.basic import AnsibleModule # pragma: no cover
|
||||
from cryptography.hazmat.primitives.asymmetric.types import ( # pragma: no cover
|
||||
@@ -336,8 +335,8 @@ def select_backend(
|
||||
|
||||
__all__ = (
|
||||
"PrivateKeyConsistencyError",
|
||||
"PrivateKeyParseError",
|
||||
"PrivateKeyInfoRetrieval",
|
||||
"PrivateKeyParseError",
|
||||
"get_privatekey_info",
|
||||
"select_backend",
|
||||
)
|
||||
|
||||
@@ -21,7 +21,6 @@ from ansible_collections.community.crypto.plugins.module_utils._cryptography_dep
|
||||
assert_required_cryptography_version,
|
||||
)
|
||||
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
from ansible.module_utils.basic import AnsibleModule # pragma: no cover
|
||||
from cryptography.hazmat.primitives.asymmetric.types import ( # pragma: no cover
|
||||
@@ -178,8 +177,8 @@ def select_backend(
|
||||
|
||||
|
||||
__all__ = (
|
||||
"PublicKeyParseError",
|
||||
"PublicKeyInfoRetrieval",
|
||||
"PublicKeyParseError",
|
||||
"get_publickey_info",
|
||||
"select_backend",
|
||||
)
|
||||
|
||||
@@ -9,7 +9,6 @@ from __future__ import annotations
|
||||
|
||||
import typing as t
|
||||
|
||||
|
||||
PEM_START = "-----BEGIN "
|
||||
PEM_END_START = "-----END "
|
||||
PEM_END = "-----"
|
||||
@@ -128,14 +127,14 @@ def extract_pem(content: str, *, strict: bool = False) -> tuple[str, str]:
|
||||
|
||||
|
||||
__all__ = (
|
||||
"PEM_START",
|
||||
"PEM_END_START",
|
||||
"PEM_END",
|
||||
"PKCS8_PRIVATEKEY_NAMES",
|
||||
"PEM_END_START",
|
||||
"PEM_START",
|
||||
"PKCS1_PRIVATEKEY_SUFFIX",
|
||||
"PKCS8_PRIVATEKEY_NAMES",
|
||||
"extract_first_pem",
|
||||
"extract_pem",
|
||||
"identify_pem_format",
|
||||
"identify_private_key_format",
|
||||
"split_pem_list",
|
||||
"extract_first_pem",
|
||||
"extract_pem",
|
||||
)
|
||||
|
||||
@@ -23,7 +23,6 @@ from ansible_collections.community.crypto.plugins.module_utils._crypto.pem impor
|
||||
identify_pem_format,
|
||||
)
|
||||
|
||||
|
||||
try:
|
||||
from cryptography import x509
|
||||
from cryptography.exceptions import UnsupportedAlgorithm
|
||||
@@ -38,7 +37,6 @@ from ansible_collections.community.crypto.plugins.module_utils._crypto.basic imp
|
||||
OpenSSLObjectError,
|
||||
)
|
||||
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
from ansible.module_utils.basic import AnsibleModule # pragma: no cover
|
||||
from cryptography.hazmat.primitives.asymmetric.types import ( # pragma: no cover
|
||||
@@ -467,17 +465,17 @@ class OpenSSLObject(metaclass=abc.ABCMeta):
|
||||
|
||||
|
||||
__all__ = (
|
||||
"OpenSSLObject",
|
||||
"get_fingerprint",
|
||||
"get_fingerprint_of_bytes",
|
||||
"get_fingerprint_of_privatekey",
|
||||
"get_fingerprint",
|
||||
"load_privatekey",
|
||||
"load_certificate_privatekey",
|
||||
"load_certificate_issuer_privatekey",
|
||||
"load_publickey",
|
||||
"load_certificate",
|
||||
"load_certificate_issuer_privatekey",
|
||||
"load_certificate_privatekey",
|
||||
"load_certificate_request",
|
||||
"load_privatekey",
|
||||
"load_publickey",
|
||||
"parse_name_field",
|
||||
"parse_ordered_name_field",
|
||||
"select_message_digest",
|
||||
"OpenSSLObject",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user