Skip to content

Commit

Permalink
Fix Python error in crypto.import_cert() (#262)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
SilleBille committed Sep 23, 2019
1 parent 9844701 commit 4c98ff8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions base/common/python/pki/crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4c98ff8

Please sign in to comment.