'Return WSGI environ entries to be merged into each request.'

def get_environ(self):

    ssl_environ = {'HTTPS': 'on'}
    if self.certificate:
        cert = open(self.certificate, 'rb').read()
        cert = crypto.load_certificate(crypto.FILETYPE_PEM, cert)
        ssl_environ.update({'SSL_SERVER_M_VERSION': cert.get_version(), 'SSL_SERVER_M_SERIAL': cert.get_serial_number()})
        for (prefix, dn) in [('I', cert.get_issuer()), ('S', cert.get_subject())]:
            dnstr = str(dn)[18:(-2)]
            wsgikey = ('SSL_SERVER_%s_DN' % prefix)
            ssl_environ[wsgikey] = dnstr
            while dnstr:
                pos = dnstr.rfind('=')
                (dnstr, value) = (dnstr[:pos], dnstr[(pos + 1):])
                pos = dnstr.rfind('/')
                (dnstr, key) = (dnstr[:pos], dnstr[(pos + 1):])
                if (key and value):
                    wsgikey = ('SSL_SERVER_%s_DN_%s' % (prefix, key))
                    ssl_environ[wsgikey] = value
    return ssl_environ
