mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-04-26 16:36:35 +00:00
acme_challenge_cert_helper: adjust private key check (#1007)
* Adjust private key check. * Fix sorting.
This commit is contained in:
2
changelogs/fragments/1007-cryptography-47.yml
Normal file
2
changelogs/fragments/1007-cryptography-47.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- "acme_challenge_cert_helper - adjust private key check for new private key types in cryptography 47.0.0 (https://github.com/ansible-collections/community.crypto/pull/1007)."
|
||||
@@ -175,13 +175,13 @@ from ansible_collections.community.crypto.plugins.module_utils._time import (
|
||||
try:
|
||||
import cryptography
|
||||
import cryptography.hazmat.backends
|
||||
import cryptography.hazmat.primitives.asymmetric.dh
|
||||
import cryptography.hazmat.primitives.asymmetric.dsa
|
||||
import cryptography.hazmat.primitives.asymmetric.ec
|
||||
import cryptography.hazmat.primitives.asymmetric.ed448
|
||||
import cryptography.hazmat.primitives.asymmetric.ed25519
|
||||
import cryptography.hazmat.primitives.asymmetric.padding
|
||||
import cryptography.hazmat.primitives.asymmetric.rsa
|
||||
import cryptography.hazmat.primitives.asymmetric.utils
|
||||
import cryptography.hazmat.primitives.asymmetric.x448
|
||||
import cryptography.hazmat.primitives.asymmetric.x25519
|
||||
import cryptography.hazmat.primitives.hashes
|
||||
import cryptography.hazmat.primitives.serialization
|
||||
import cryptography.x509
|
||||
@@ -241,12 +241,14 @@ def main() -> t.NoReturn:
|
||||
)
|
||||
except Exception as e:
|
||||
raise ModuleFailException(f"Error while loading private key: {e}") from e
|
||||
if isinstance(
|
||||
if not isinstance(
|
||||
private_key,
|
||||
(
|
||||
cryptography.hazmat.primitives.asymmetric.dh.DHPrivateKey,
|
||||
cryptography.hazmat.primitives.asymmetric.x25519.X25519PrivateKey,
|
||||
cryptography.hazmat.primitives.asymmetric.x448.X448PrivateKey,
|
||||
cryptography.hazmat.primitives.asymmetric.ed25519.Ed25519PrivateKey,
|
||||
cryptography.hazmat.primitives.asymmetric.ed448.Ed448PrivateKey,
|
||||
cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey,
|
||||
cryptography.hazmat.primitives.asymmetric.dsa.DSAPrivateKey,
|
||||
cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKey,
|
||||
),
|
||||
):
|
||||
raise ModuleFailException(
|
||||
|
||||
Reference in New Issue
Block a user