[Twisted-Python] twisted ssl server and client

John Aherne johnaherne at rocs.co.uk
Mon Nov 10 03:32:01 MST 2014


So I am now looking at CertificateOptions in more detail.

But I am stuck trying to figure out how to add my GoDaddy cert to trustRoot.

Here is what I am doing so far to see what is happening. Bu I think I am
getting further and further from what I should be doing.

If anyone can point out what must be the obvious thing to do, GREAT!


#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.

import sys

from twisted.internet import reactor, ssl, protocol, task, defer
from twisted.python import log

import echoserv

log.startLogging(sys.stdout)

ctx = ssl.CertificateOptions()

certData2 = open('d:\\openssl\\ibook\\ibook2.pem', 'rb').read()
certificate2 = ssl.PrivateCertificate.loadPEM(certData2)

print 'CERT2', certificate2.options
print 'CERT2', dir(certificate2)
print 'CERT2 OPTIONS', certificate2.options()
print 'CERT2OPTS', dir(certificate2.options)
certGD = open('d:\\openssl\\ibook\\gd_bundle-g2-g1.crt', 'rb').read()
#ctx.trustRoot = ssl.Certificate.loadPEM(certGD)
certificate3  = certificate2.options(ssl.Certificate.loadPEM(certGD))
print 'cERT3', certificate3.privateKey
print 'trustRoot2TROOT', certificate3.trustRoot
#certificate2.options().trustRoot = ssl.Certificate.loadPEM(certGD)
print 'trustRoot', certificate3
print 'trustRoot2type', type(certificate3.trustRoot)
print 'trustRoot2TROOT', certificate3.trustRoot
print 'trustRoot2PK', certificate3.privateKey
print 'trustRoot2CERT', certificate3.certificate
print 'trustRoot2VER', certificate3.verify
#print 'trustRoot2', ctx.trustRoot

factory = protocol.Factory.forProtocol(echoserv.Echo)
reactor.listenSSL(8000, factory, certificate2.options(certificate3))
#reactor.listenSSL(8000, factory, certificate3)


reactor.run()


Thanks for any pointers.



-- 
*John Aherne*




*www.rocs.co.uk <http://www.rocs.co.uk>*
020 7223 7567
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20141110/d44bfef7/attachment-0002.html>


More information about the Twisted-Python mailing list