Skip to content

Commit

Permalink
cert_find: fix call with --all
Browse files Browse the repository at this point in the history
When ipa cert-find --all is called, the function prints the
certificate public bytes. The code recently switched to OpenSSL.crypto
and the objects OpenSSL.crypto.X509 do not have the method
public_bytes(). Use to_cryptography() to transform into a
cryptography.x509.Certificate before calling public_bytes().

Related: https://pagure.io/freeipa/issue/9331

Signed-off-by: Florence Blanc-Renaud <[email protected]>
Reviewed-By: Rob Crittenden <[email protected]>
  • Loading branch information
flo-renaud authored and rcritten committed Apr 28, 2023
1 parent fd0fd48 commit 1f30cc6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions ipaserver/plugins/cert.py
Original file line number Diff line number Diff line change
Expand Up @@ -1827,6 +1827,7 @@ def _ldap_search(self, all, pkey_only, no_members, **options):
# For the case of CA-less we need to keep
# the certificate because getting it again later
# would require unnecessary LDAP searches.
cert = cert.to_cryptography()
obj['certificate'] = (
base64.b64encode(
cert.public_bytes(x509.Encoding.DER))
Expand Down

0 comments on commit 1f30cc6

Please sign in to comment.