zephir.certificats

Package zephir :: Module certificats |
[frames] | no frames]

# Source Code for Module zephir.certificats

     1  # -*- coding: UTF-8 -*-
     2  import os
     3  from OpenSSL import SSL
     4  from zephir.config import ROOT_DIR, cert_file, key_file
     5
     6  #################################################
     7  ## Factory permettant de créer un contexte SSL ##
     8  #################################################
     9 -class ServerContextFactory:
    10
    11 -    def getContext(self):
    12          """Create an SSL context.
    13          This is a sample implementation that loads a certificate from a file
    14          called 'server.pem'."""
    15          ctx = SSL.Context(SSL.SSLv23_METHOD)
    16          ctx.use_certificate_file(cert_file)
    17          ctx.use_privatekey_file(key_file)
    18          return ctx
    19