mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-11 03:31:29 -07:00
openssl_certificate_info, openssl_csr: fix wrong exception, and little refactoring (#54922)
* Fix wrong exception name. * Use crypto_utils.load_certificate_request() to load CSRs with both backends.
This commit is contained in:
parent
dafdcf286a
commit
c5991b970f
2 changed files with 4 additions and 5 deletions
|
@ -632,7 +632,7 @@ class CertificateSigningRequestPyOpenSSL(CertificateSigningRequestBase):
|
|||
return False
|
||||
|
||||
try:
|
||||
csr = crypto_utils.load_certificate_request(self.path)
|
||||
csr = crypto_utils.load_certificate_request(self.path, backend='pyopenssl')
|
||||
except Exception as dummy:
|
||||
return False
|
||||
|
||||
|
@ -819,8 +819,7 @@ class CertificateSigningRequestCryptography(CertificateSigningRequestBase):
|
|||
return key_a == key_b
|
||||
|
||||
try:
|
||||
with open(self.path, 'rb') as f:
|
||||
csr = cryptography.x509.load_pem_x509_csr(f.read(), self.cryptography_backend)
|
||||
csr = crypto_utils.load_certificate_request(self.path, backend='cryptography')
|
||||
except Exception as dummy:
|
||||
return False
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue