mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-03-26 21:33:25 +00:00
Fix EC detection. (#981)
This commit is contained in:
2
changelogs/fragments/981-ec.yml
Normal file
2
changelogs/fragments/981-ec.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- "crypto_info, openssl_privatekey, openssl_privatekey_pipe - fix detection of EC support for cryptography 46.0.5+ (https://github.com/ansible-collections/community.crypto/pull/981)."
|
||||
@@ -98,7 +98,7 @@ class _Curve:
|
||||
) -> type[cryptography.hazmat.primitives.asymmetric.ec.EllipticCurve]:
|
||||
ecclass: (
|
||||
type[cryptography.hazmat.primitives.asymmetric.ec.EllipticCurve] | None
|
||||
) = cryptography.hazmat.primitives.asymmetric.ec.__dict__.get(self.ectype)
|
||||
) = getattr(cryptography.hazmat.primitives.asymmetric.ec, self.ectype, None)
|
||||
if ecclass is None:
|
||||
module.fail_json(
|
||||
msg=f"Your cryptography version does not support {self.ectype}"
|
||||
|
||||
@@ -350,8 +350,8 @@ def add_crypto_information(module: AnsibleModule) -> dict[str, t.Any]:
|
||||
pass
|
||||
else:
|
||||
for curve_name, constructor_name in CURVES:
|
||||
ecclass = ec.__dict__.get(constructor_name)
|
||||
if ecclass:
|
||||
ecclass = getattr(ec, constructor_name, None)
|
||||
if ecclass is not None:
|
||||
try:
|
||||
ec.generate_private_key(curve=ecclass())
|
||||
curves.append(curve_name)
|
||||
|
||||
Reference in New Issue
Block a user