2 # Copyright (c) Twisted Matrix Laboratories.
3 # See LICENSE for details.
6 from twisted.internet import ssl
7 from twisted.python.util import sibpath
9 from OpenSSL import SSL
11 class ClientTLSContext(ssl.ClientContextFactory):
14 return SSL.Context(SSL.TLSv1_METHOD)
16 class ServerTLSContext:
19 def __init__(self, filename = sibpath(__file__, 'server.pem')):
20 self.filename = filename
23 ctx = SSL.Context(SSL.TLSv1_METHOD)
24 ctx.use_certificate_file(self.filename)
25 ctx.use_privatekey_file(self.filename)