K2LL33D SHELL

 Apache/2.4.7 (Ubuntu)
 Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64
 uid=33(www-data) gid=33(www-data) groups=33(www-data)
 safemode : OFF
 MySQL: ON | Perl: ON | cURL: OFF | WGet: ON
  >  / usr / lib / python2.7 / dist-packages / twisted / test /
server ip : 104.21.89.46

your ip : 172.69.130.111

H O M E


Filename/usr/lib/python2.7/dist-packages/twisted/test/ssl_helpers.py
Size981
Permissionrw-r--r--
Ownerroot : root
Create time27-Apr-2025 09:56
Last modified06-Nov-2012 22:15
Last accessed07-Jul-2025 00:08
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.

"""
Helper classes for twisted.test.test_ssl.

They are in a separate module so they will not prevent test_ssl importing if
pyOpenSSL is unavailable.
"""
from __future__ import division, absolute_import

from twisted.python.compat import nativeString
from twisted.internet import ssl
from twisted.python.filepath import FilePath

from OpenSSL import SSL

certPath = nativeString(FilePath(__file__.encode("utf-8")
).sibling(b"server.pem").path)


class ClientTLSContext(ssl.ClientContextFactory):
isClient = 1
def getContext(self):
return SSL.Context(SSL.TLSv1_METHOD)

class ServerTLSContext:
isClient = 0

def __init__(self, filename=certPath):
self.filename = filename

def getContext(self):
ctx = SSL.Context(SSL.TLSv1_METHOD)
ctx.use_certificate_file(self.filename)
ctx.use_privatekey_file(self.filename)
return ctx