use open instead of file

This commit is contained in:
Thomas Kriechbaumer 2015-06-05 20:52:11 +02:00
parent 6c1c6f5f0a
commit f2db8abbe8

View File

@ -75,13 +75,13 @@ class TServer(tcp.TCPServer):
raw_cert = self.ssl.get( raw_cert = self.ssl.get(
"cert", "cert",
tutils.test_data.path("data/server.crt")) tutils.test_data.path("data/server.crt"))
cert = certutils.SSLCert.from_pem(file(raw_cert, "rb").read()) cert = certutils.SSLCert.from_pem(open(raw_cert, "rb").read())
raw_key = self.ssl.get( raw_key = self.ssl.get(
"key", "key",
tutils.test_data.path("data/server.key")) tutils.test_data.path("data/server.key"))
key = OpenSSL.crypto.load_privatekey( key = OpenSSL.crypto.load_privatekey(
OpenSSL.crypto.FILETYPE_PEM, OpenSSL.crypto.FILETYPE_PEM,
file(raw_key, "rb").read()) open(raw_key, "rb").read())
if self.ssl.get("v3_only", False): if self.ssl.get("v3_only", False):
method = tcp.SSLv3_METHOD method = tcp.SSLv3_METHOD
options = OpenSSL.SSL.OP_NO_SSLv2 | OpenSSL.SSL.OP_NO_TLSv1 options = OpenSSL.SSL.OP_NO_SSLv2 | OpenSSL.SSL.OP_NO_TLSv1