summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2016-02-19 17:51:27 +0100
committerJan Cholasta <jcholast@redhat.com>2016-03-03 10:31:55 +0100
commit34db5759fa8733d875377f4b487d1bcfbf768b0e (patch)
tree4daceeb20e84ce484a57f0a5dec3a4d1c3111d6f
parent272ff9d1f71e1b49645b7ceb0e6db975f4625ff0 (diff)
downloadfreeipa-34db5759fa8733d875377f4b487d1bcfbf768b0e.tar.gz
freeipa-34db5759fa8733d875377f4b487d1bcfbf768b0e.tar.xz
freeipa-34db5759fa8733d875377f4b487d1bcfbf768b0e.zip
ipalib.x809: Accept bytes for make_pem
Part of the work for https://fedorahosted.org/freeipa/ticket/5638 Reviewed-By: Jan Cholasta <jcholast@redhat.com>
-rw-r--r--ipalib/x509.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/ipalib/x509.py b/ipalib/x509.py
index 2d28876de..2edd3fef2 100644
--- a/ipalib/x509.py
+++ b/ipalib/x509.py
@@ -272,6 +272,8 @@ def make_pem(data):
Convert a raw base64-encoded blob into something that looks like a PE
file with lines split to 64 characters and proper headers.
"""
+ if isinstance(data, bytes):
+ data = data.decode('ascii')
pemcert = '\r\n'.join([data[x:x+64] for x in range(0, len(data), 64)])
return '-----BEGIN CERTIFICATE-----\n' + \
pemcert + \