summary refs log tree commit diff
path: root/synapse/config/tls.py
diff options
context:
space:
mode:
authorAdrian Tschira <nota@notafile.com>2018-04-10 17:22:52 +0200
committerAdrian Tschira <nota@notafile.com>2018-04-10 17:36:29 +0200
commita3f9ddbeded33c61a715c86ba5029954ba22c22d (patch)
tree54ce4422c6c22b6c834373e709992a470df1ce10 /synapse/config/tls.py
parentMerge branch 'release-v0.27.0' of https://github.com/matrix-org/synapse into ... (diff)
downloadsynapse-a3f9ddbeded33c61a715c86ba5029954ba22c22d.tar.xz
Open certificate files as bytes
That's what pyOpenSSL expects on python3

Signed-off-by: Adrian Tschira <nota@notafile.com>
Diffstat (limited to '')
-rw-r--r--synapse/config/tls.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/synapse/config/tls.py b/synapse/config/tls.py
index 29eb012ddb..b66154bc7c 100644
--- a/synapse/config/tls.py
+++ b/synapse/config/tls.py
@@ -133,7 +133,7 @@ class TlsConfig(Config):
         tls_dh_params_path = config["tls_dh_params_path"]
 
         if not self.path_exists(tls_private_key_path):
-            with open(tls_private_key_path, "w") as private_key_file:
+            with open(tls_private_key_path, "wb") as private_key_file:
                 tls_private_key = crypto.PKey()
                 tls_private_key.generate_key(crypto.TYPE_RSA, 2048)
                 private_key_pem = crypto.dump_privatekey(
@@ -148,7 +148,7 @@ class TlsConfig(Config):
                 )
 
         if not self.path_exists(tls_certificate_path):
-            with open(tls_certificate_path, "w") as certificate_file:
+            with open(tls_certificate_path, "wb") as certificate_file:
                 cert = crypto.X509()
                 subject = cert.get_subject()
                 subject.CN = config["server_name"]