def _makeQ2QService(self, certificateEntity, publicIP, pff=None): svc = q2q.Q2QService(pff, q2qPortnum=0, inboundTCPPortnum=self.inboundTCPPortnum, publicIP=publicIP) svc.udpEnabled = self.udpEnabled svc.virtualEnabled = self.virtualEnabled if '@' not in certificateEntity: svc.certificateStorage.addPrivateCertificate(certificateEntity) svc.debugName = certificateEntity return svc
def setup_Q2Q(self, path, q2qPortnum=q2q.port, inboundTCPPortnum=q2q.port+1, publicIP=None ): """Set up a Q2Q service. """ store = DirectoryCertificateAndUserStore(path) # store.addPrivateCertificate("kazekage") # store.addUser("kazekage", "username", "password1234") self.attach(q2q.Q2QService( protocolFactoryFactory=IdentityAdminFactory(store).examineRequest, certificateStorage=store, portal=Portal(store, checkers=[store]), q2qPortnum=q2qPortnum, inboundTCPPortnum=inboundTCPPortnum, publicIP=publicIP, ))
def testServiceInitialization(self): svc = q2q.Q2QService(noResources) svc.certificateStorage.addPrivateCertificate("test.domain") cert = svc.certificateStorage.getPrivateCertificate("test.domain") self.failUnless(cert.getPublicKey().matches(cert.privateKey))