From 4d0f63cd3a4f67c0f64aee37d3e54c5c0b8b5166 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Tue, 5 Mar 2013 15:58:20 +0100 Subject: [PATCH] Fix Jingle XTLS certificate creation. --- src/common/jingle_xtls.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/jingle_xtls.py b/src/common/jingle_xtls.py index 8ceb8dc15..43b071892 100644 --- a/src/common/jingle_xtls.py +++ b/src/common/jingle_xtls.py @@ -236,10 +236,10 @@ def make_certs(filepath, CN): key = createKeyPair(TYPE_RSA, 1024) req = createCertRequest(key, CN=CN) cert = createCertificate(req, req, key, 0, 0, 60*60*24*365*5) # five years - open(filepath + '.pkey', 'w').write(crypto.dump_privatekey( - crypto.FILETYPE_PEM, key)) - open(filepath + '.cert', 'w').write(crypto.dump_certificate( - crypto.FILETYPE_PEM, cert)) + with open(filepath + '.pkey', 'wb') as f: + f.write(crypto.dump_privatekey(crypto.FILETYPE_PEM, key)) + with open(filepath + '.cert', 'wb') as f: + f.write(crypto.dump_certificate(crypto.FILETYPE_PEM, cert)) if __name__ == '__main__':