[Twisted-Python] dont get ssl Server working

arne-weiss at web.de arne-weiss at web.de
Thu Aug 21 04:31:23 MDT 2008


I tried to use ssl via twisted and I don't know why it doesn't work. If a client tries to connect ConnectionLost says:
[('SSL routines', 'SSL3_READ_BYTES', 'sslv3 alert bad certificate'), ('SSL routines', 'SSL3_READ_BYTES', 'ssl handshake failure')]

I tried different CAs, so there schould be no failure.
Do I have to do something else like SSL.Context(method).set_accept_state() manually?

My Code in basic looks like the following:
http://nopaste.info/8bd9bd8536.html

# class TLSProtocol(protocol.Protocol,  ssl.Server):
#  
#     def connectionLost(self, reason):
#         print "Connection Lost:"
#         print reason.getErrorMessage()
#  
#     def dataReceived(self, data):
#         print "Data Received: %s"%data
#  
#  
#  
# class Factory(protocol.ServerFactory):
#     protocol = TLSProtocol
#  
#     def buildProtocol(self,  addr):
#         p = self.protocol()
#         return p
#    
#     def clientConnectionLost(self, transport, reason):
#         print "Connection Lost: %s"%reason.getErrorMessage()
#         reactor.stop( )
#        
#     def clientConnectionFailed(self, transport, reason):
#         print "connection Failed: %s"%reason.getErrorMessage( )
#         reactor.stop( )
#  
#  
#  
# class ContextFactory(ssl.ContextFactory):
#  
#     def __init__(self):
#         sslmethod = SSL.TLSv1_METHOD
#  
#         ctx = SSL.Context(sslmethod)
#         ctx.use_certificate_file('ssl.crt')
#         ctx.use_privatekey_file('ssl.key')
#        
#         self._context = ctx
#  
#     def getContext(self):
#         "Create an SSL context"
#  
#         return self._context
#  
#  
#  
# reactor.listenSSL(8601,  Factory(), ContextFactory())
# reactor.run() 
_______________________________________________________________________
EINE FÜR ALLE: die kostenlose WEB.DE-Plattform für Freunde und Deine
Homepage mit eigenem Namen. Jetzt starten! http://unddu.de/?kid=kid@mf2





More information about the Twisted-Python mailing list