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>
This commit is contained in:
Petr Viktorin authored and Jan Cholasta committed 2016-03-03 10:31:55 +01:00
1 parent 272ff9d1f7
commit 34db5759fa
1 file changed
+2
+2
View File
@@ -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 + \