summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2018-04-30 01:00:05 +0100
committerGitHub <noreply@github.com>2018-04-30 01:00:05 +0100
commitb8ee12b978cad4800deb4a556a693c09282ebc4e (patch)
tree79f887ffcfdfe5ef21b74e8eb50866c95a2f7bb0 /synapse
parentMerge pull request #3154 from NotAFile/py3-stringio (diff)
parentOpen certificate files as bytes (diff)
downloadsynapse-b8ee12b978cad4800deb4a556a693c09282ebc4e.tar.xz
Merge pull request #3084 from NotAFile/py3-certs-byte-mode
Open certificate files as bytes
Diffstat (limited to 'synapse')
-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"]