mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-10-25 06:38:02 -05:00
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:
1 parent
272ff9d1f7
commit
34db5759fa
1 file changed
+2
@@ -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 + \
|
||||
|
||||
Reference in new issue
Block a user