mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
openssl_csr: Ensure array comparison is deterministic (#28265)
When comparing expected and current value for keyUsage and extendedKeyUsage current behavior is not deterministic. As we compare two arrays, based on the order the value have been specified, False might be returned when the two arrays actually matches. In order to have a deterministic comparison we compare sets rather than arrays.
This commit is contained in:
parent
665257ef18
commit
b658ea8da2
1 changed files with 1 additions and 1 deletions
|
@ -354,7 +354,7 @@ class CertificateSigningRequest(crypto_utils.OpenSSLObject):
|
|||
else:
|
||||
current = [usage.strip() for usage in str(usages_ext[0]).split(',')]
|
||||
expected = [long[usage] if usage in long else usage for usage in expected]
|
||||
return current == expected and usages_ext[0].get_critical() == critical
|
||||
return set(current) == set(expected) and usages_ext[0].get_critical() == critical
|
||||
|
||||
def _check_keyUsage(extensions):
|
||||
return _check_keyUsage_(extensions, b'keyUsage', self.keyUsage, self.keyUsage_critical, crypto_utils.keyUsageLong)
|
||||
|
|
Loading…
Reference in a new issue