From 500c96abe21f27bf13d74e4104241ae120e55f34 Mon Sep 17 00:00:00 2001
From: Ivanq <imachug@yandex.ru>
Date: Mon, 2 Sep 2019 14:35:28 +0000
Subject: [PATCH] Fix UnicodeDecodeError when OpenSSL is not found

Fixes #2180
---
 src/Crypt/CryptConnection.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Crypt/CryptConnection.py b/src/Crypt/CryptConnection.py
index 7fc64152..9734089e 100644
--- a/src/Crypt/CryptConnection.py
+++ b/src/Crypt/CryptConnection.py
@@ -137,14 +137,14 @@ class CryptConnectionManager:
             cmd, shell=True, stderr=subprocess.STDOUT,
             stdout=subprocess.PIPE, env=self.openssl_env
         )
-        back = proc.stdout.read().strip().decode().replace("\r", "")
+        back = proc.stdout.read().strip().replace(b"\r", b"")
         proc.wait()
 
         if not (os.path.isfile(self.cacert_pem) and os.path.isfile(self.cakey_pem)):
             self.log.error("RSA ECC SSL CAcert generation failed, CAcert or CAkey files not exist. (%s)" % back)
             return False
         else:
-            self.log.debug("Result: %s" % back)
+            self.log.debug("Result: %s" % back.decode())
 
         # Generate certificate key and signing request
         cmd_params = helper.shellquote(