From 34db5759fa8733d875377f4b487d1bcfbf768b0e Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Fri, 19 Feb 2016 17:51:27 +0100 Subject: [PATCH] ipalib.x809: Accept bytes for make_pem Part of the work for https://fedorahosted.org/freeipa/ticket/5638 Reviewed-By: Jan Cholasta --- ipalib/x509.py | 2 ++ 1 file changed, 2 insertions(+) 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 + \