From d5ab0637fe89cbcb61491fe08b7376aeaf7ccdb8 Mon Sep 17 00:00:00 2001 From: Martin Basti Date: Jan 31 2017 17:33:27 +0000 Subject: py3: fix CSR encoding inside framework csr must be in string because framework excpects only strings, so we have to decode it back https://fedorahosted.org/freeipa/ticket/4985 Reviewed-By: Christian Heimes --- diff --git a/ipaserver/plugins/cert.py b/ipaserver/plugins/cert.py index c5ed9bf..5bf4cfb 100644 --- a/ipaserver/plugins/cert.py +++ b/ipaserver/plugins/cert.py @@ -804,7 +804,9 @@ class cert_request(Create, BaseCertMethod, VirtualCommand): try: # re-serialise to PEM, in case the user-supplied data has # extraneous material that will cause Dogtag to freak out - csr_pem = csr_obj.public_bytes(serialization.Encoding.PEM) + # keep it as string not bytes, it is required later + csr_pem = csr_obj.public_bytes( + serialization.Encoding.PEM).decode('utf-8') result = self.Backend.ra.request_certificate( csr_pem, profile_id, ca_id, request_type=request_type) except errors.HTTPRequestError as e: diff --git a/ipaserver/plugins/dogtag.py b/ipaserver/plugins/dogtag.py index dc33d2f..2f9fd4b 100644 --- a/ipaserver/plugins/dogtag.py +++ b/ipaserver/plugins/dogtag.py @@ -1634,7 +1634,7 @@ class ra(rabase.rabase, RestClient): self.debug('%s.request_certificate()', type(self).__name__) # Call CMS - template = ''' + template = u''' {profile}