[BangPypers] + SSL Error , while making HTTPS server

deepak gupta dg288_mits at yahoo.co.in
Sat Oct 15 10:54:08 CEST 2011


Hi All,
 
I am getting  "no OPENSSL_Applink" while creating context for HTTPS server, It occur in the line  'ctx.set_tmp_dh('dh1024.pem')'.
Do any one knows why this error occured and what will happen if I will comment 'ctx.set_tmp_dh('dh1024.pem')' line and proceed.
 
2nd problem is I am getting SSL.error : unexpected eof error, If I comment and proceed.
 
import string, os
from M2Crypto import Err, Rand, SSL, threading
from M2Crypto.SSL.SSLServer import ThreadingSSLServer
import maxInputStats
class HTTPS_Server(ThreadingSSLServer):
    def __init__(self, server_addr, handler):
     ssl_ctx = self.create_ctx()    
     ThreadingSSLServer.__init__(self, server_addr, handler, ssl_ctx)
    def finish(self):
        self.request.set_shutdown(SSL.SSL_RECEIVED_SHUTDOWN | SSL.SSL_SENT_SHUTDOWN)
        self.request.close()
    def handle_error(self, request, client_address):
 pass
    def create_ctx(self):
 try:
  sslFile = maxInputStats.CRT_FILE
 except:
  sslFile = 'maxims.crt'
 if not os.path.isfile(sslFile) :
  print("Open certificate error. The certificate (%s) cannot find!" %sslFile)
  return
     
     ctx=SSL.Context('sslv23')
     ctx.load_cert(sslFile)
     ctx.load_client_ca('')
     ctx.load_verify_info('')
     ctx.set_verify(SSL.verify_none, 10)
     ctx.set_allow_unknown_ca(1)
     ctx.set_session_id_ctx('https_srv')
     ctx.set_tmp_dh('dh1024.pem')
     return ctx
 
 
Thanks,
Deepak G.


More information about the BangPypers mailing list