[Twisted-Python] for reference - how to get ssl certificate from a xmlrpc function

Hanusz L. Hanusz at aegtranzcom.com
Thu Jan 19 10:37:14 EST 2012


I had some difficulty to find how to get the ssl certificate from the xmlrpc function but I found how to do it :
You can get the protocol from the xmlrpc function with @withRequest
http://twistedmatrix.com/documents/11.1.0/api/twisted.web.xmlrpc.withRequest.html
Then you can use getPeerCertificate from the transport

        @withRequest
        def xmlrpc_helloworld(self,request):
            return 'Hello ' +  request.channel.transport.getPeerCertificate().get_subject().commonName


#####################################################################################
This e-mail message has been scanned for Viruses and Content and cleared 
by Mailsecurity software
#####################################################################################
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20120119/2e7ecc21/attachment.htm 


More information about the Twisted-Python mailing list