Skip to content

Commit b02fb8e

Browse files
authored
certificate_complete_chain: add ability to identify ed25519 complete chains (#777)
* Add ability to identify ed25519 complete chains. * Add ability to identify ed448 complete chains. * Formatting updates * Remove unnecessary imports. * Cleanup whitespace * Fix algorithm names capitalization.
1 parent d50c3cc commit b02fb8e

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
minor_changes:
2+
- certificate_complete_chain - add ability to identify Ed25519 and Ed448 complete chains (https://github.com/ansible-collections/community.crypto/pull/777).

plugins/modules/certificate_complete_chain.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@
142142
split_pem_list,
143143
)
144144

145+
from ansible_collections.community.crypto.plugins.module_utils.crypto.basic import (
146+
CRYPTOGRAPHY_HAS_ED448_SIGN,
147+
CRYPTOGRAPHY_HAS_ED25519_SIGN,
148+
)
149+
145150
CRYPTOGRAPHY_IMP_ERR = None
146151
try:
147152
import cryptography
@@ -196,6 +201,12 @@ def is_parent(module, cert, potential_parent):
196201
cert.cert.tbs_certificate_bytes,
197202
cryptography.hazmat.primitives.asymmetric.ec.ECDSA(cert.cert.signature_hash_algorithm),
198203
)
204+
elif CRYPTOGRAPHY_HAS_ED25519_SIGN and isinstance(
205+
public_key, cryptography.hazmat.primitives.asymmetric.ed25519.Ed25519PublicKey):
206+
public_key.verify(cert.cert.signature, cert.cert.tbs_certificate_bytes)
207+
elif CRYPTOGRAPHY_HAS_ED448_SIGN and isinstance(
208+
public_key, cryptography.hazmat.primitives.asymmetric.ed448.Ed448PublicKey):
209+
public_key.verify(cert.cert.signature, cert.cert.tbs_certificate_bytes)
199210
else:
200211
# Unknown public key type
201212
module.warn('Unknown public key type "{0}"'.format(public_key))

0 commit comments

Comments
 (0)