From 4c98ff89cfaeb5e7f0bf1a48455cb725dc8602a9 Mon Sep 17 00:00:00 2001 From: Dinesh Prasanth M K Date: Mon, 23 Sep 2019 10:39:48 -0400 Subject: [PATCH] Fix Python error in crypto.import_cert() (#262) Patch to fix `import_cert()` method in crypto.py to handle both python2 and python3 based methods Fixes: https://pagure.io/dogtagpki/issue/3108 Signed-off-by: Dinesh Prasanth M K --- base/common/python/pki/crypto.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/base/common/python/pki/crypto.py b/base/common/python/pki/crypto.py index a5fe3f70768..e202945c61a 100644 --- a/base/common/python/pki/crypto.py +++ b/base/common/python/pki/crypto.py @@ -194,6 +194,9 @@ def import_cert(self, cert_nick, cert, trust=',,'): else: content = cert + if type(content) is not six.binary_type: + content = content.encode() + # certutil -A -d db_dir -n cert_nick -t trust -i cert_file with tempfile.NamedTemporaryFile() as cert_file: cert_file.write(content)