mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-08-13 06:25:00 -05:00
Fix certificate type error when exporting to file
Commands `ipa ca-show` and `ipa cert-show` share the same code,
this commit updates the former, closing the gap between them.
Reflecting the changes done in 5a44ca6383.
https://pagure.io/freeipa/issue/7628
Signed-off-by: Armando Neto <abiagion@redhat.com>
Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
committed by
Christian Heimes
parent
c29581c9a0
commit
c7064494e5
@@ -1,6 +1,7 @@
|
||||
#
|
||||
# Copyright (C) 2016 FreeIPA Contributors see COPYING for license
|
||||
#
|
||||
import base64
|
||||
|
||||
from ipaclient.frontend import MethodOverride
|
||||
from ipalib import errors, util, x509, Str
|
||||
@@ -34,13 +35,11 @@ class WithCertOutArgs(MethodOverride):
|
||||
result = super(WithCertOutArgs, self).forward(*keys, **options)
|
||||
if filename:
|
||||
if options.get('chain', False):
|
||||
certs = (x509.load_der_x509_certificate(c)
|
||||
for c in result['result']['certificate_chain'])
|
||||
certs = result['result']['certificate_chain']
|
||||
else:
|
||||
certs = [
|
||||
x509.load_der_x509_certificate(
|
||||
result['result']['certificate'])
|
||||
]
|
||||
certs = [result['result']['certificate']]
|
||||
certs = (x509.load_der_x509_certificate(base64.b64decode(cert))
|
||||
for cert in certs)
|
||||
x509.write_certificate_list(certs, filename)
|
||||
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user