示例#1
0
文件: server.py 项目: grwl/sslcaudit
from txjsonrpc.test import certs
from txjsonrpc.web import jsonrpc
from twisted.web import server
from twisted.internet import reactor, ssl

class Math(jsonrpc.JSONRPC):
    """
    An example object to be published.
    """
    def jsonrpc_add(self, a, b):
        """
        Return sum of arguments.
        """
        return a + b

sslContext = ssl.DefaultOpenSSLContextFactory(
	certs.key_file('pyserver'),
    certs.cert_file('pyserver')
#    certs.key_file('127.0.0.1'),
#    certs.cert_file('127.0.0.1')
)

reactor.listenSSL(
	7443,
	server.Site(Math()),
	contextFactory = sslContext,
)
reactor.run()

示例#2
0
from txjsonrpc.test import certs
from txjsonrpc.web import jsonrpc
from twisted.web import server
from twisted.internet import reactor, ssl


class Math(jsonrpc.JSONRPC):
    """
    An example object to be published.
    """
    def jsonrpc_add(self, a, b):
        """
        Return sum of arguments.
        """
        return a + b


sslContext = ssl.DefaultOpenSSLContextFactory(
    certs.key_file('pyserver'),
    certs.cert_file('pyserver')
    #    certs.key_file('127.0.0.1'),
    #    certs.cert_file('127.0.0.1')
)

reactor.listenSSL(
    7443,
    server.Site(Math()),
    contextFactory=sslContext,
)
reactor.run()
示例#3
0
 def __init__(self):
     # here we use certificates from txjsonrpc/test/certs/ directory
     self.ca_cert_file = certs.ca_cert_file()
     self.cert_file = certs.cert_file('pyclient')
     self.key_file = certs.key_file('pyclient')