diff --git a/ipaserver/plugins/cert.py b/ipaserver/plugins/cert.py index 36a0e8cb3..4fb85069a 100644 --- a/ipaserver/plugins/cert.py +++ b/ipaserver/plugins/cert.py @@ -1795,7 +1795,8 @@ class cert_find(Search, CertMethod): ca_enabled = getattr(context, 'ca_enabled') for entry in entries: for attr in ('usercertificate', 'usercertificate;binary'): - for cert in entry.get(attr, []): + for der in entry.raw.get(attr, []): + cert = cryptography.x509.load_der_x509_certificate(der) cert_key = self._get_cert_key(cert) try: obj = result[cert_key] diff --git a/ipatests/test_xmlrpc/test_cert_plugin.py b/ipatests/test_xmlrpc/test_cert_plugin.py index 433cebcd7..583c67fd9 100644 --- a/ipatests/test_xmlrpc/test_cert_plugin.py +++ b/ipatests/test_xmlrpc/test_cert_plugin.py @@ -254,6 +254,16 @@ class test_cert(BaseCert): result = _emails_are_valid(email_addrs, []) assert not result + def test_00012_cert_find_all(self): + """ + Test that cert-find --all returns successfully. + + We don't know how many we'll get but there should be at least 10 + by default. + """ + res = api.Command['cert_find'](all=True) + assert 'count' in res and res['count'] >= 10 + def test_99999_cleanup(self): """ Clean up cert test data @@ -283,7 +293,7 @@ class test_cert_find(XMLRPC_test): short = api.env.host.split('.', maxsplit=1)[0] - def test_0001_find_all(self): + def test_0001_find_all_certs(self): """ Search for all certificates.