mirror of https://github.com/nucypher/nucypher.git
These three files are no longer useful.
parent
84f7c4a604
commit
18058b2634
|
@ -1,16 +0,0 @@
|
|||
from kademlia.network import Server
|
||||
import asyncio
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.set_debug(True)
|
||||
server = Server()
|
||||
server.listen(8468)
|
||||
|
||||
try:
|
||||
loop.run_forever()
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
||||
loop.close()
|
|
@ -1,38 +0,0 @@
|
|||
from twisted.python.filepath import FilePath
|
||||
from twisted.internet.endpoints import SSL4ClientEndpoint
|
||||
from twisted.internet.ssl import (
|
||||
PrivateCertificate, Certificate, optionsForClientTLS)
|
||||
from twisted.internet.defer import Deferred, inlineCallbacks
|
||||
from twisted.internet.task import react
|
||||
from twisted.internet.protocol import Protocol, Factory
|
||||
|
||||
from nkms.network import generate_certs
|
||||
|
||||
|
||||
class SendAnyData(Protocol):
|
||||
def connectionMade(self):
|
||||
self.deferred = Deferred()
|
||||
self.transport.write(b"HELLO\r\n")
|
||||
def connectionLost(self, reason):
|
||||
self.deferred.callback(None)
|
||||
|
||||
|
||||
@inlineCallbacks
|
||||
def main(reactor):
|
||||
pem = generate_certs.and_generate()
|
||||
caPem = FilePath(b"ca-private-cert.pem").getContent()
|
||||
clientEndpoint = SSL4ClientEndpoint(
|
||||
reactor, u"localhost", 4321,
|
||||
optionsForClientTLS(u"the-authority", Certificate.loadPEM(caPem),
|
||||
PrivateCertificate.loadPEM(pem)),
|
||||
)
|
||||
clientEndpoint = SSL4ClientEndpoint(
|
||||
reactor, u"localhost", 4321,
|
||||
optionsForClientTLS(u"the-authority", Certificate.loadPEM(caPem),
|
||||
PrivateCertificate.loadPEM(pem)),
|
||||
)
|
||||
proto = yield clientEndpoint.connect(Factory.forProtocol(SendAnyData))
|
||||
yield proto.deferred
|
||||
|
||||
what_happened = react(main)
|
||||
print(what_happened)
|
|
@ -1,24 +0,0 @@
|
|||
from twisted.python.filepath import FilePath
|
||||
from twisted.internet.endpoints import SSL4ServerEndpoint
|
||||
from twisted.internet.ssl import PrivateCertificate, Certificate
|
||||
from twisted.internet.defer import Deferred
|
||||
from twisted.internet.task import react
|
||||
from twisted.internet.protocol import Protocol, Factory
|
||||
|
||||
class ReportWhichClient(Protocol):
|
||||
def dataReceived(self, data):
|
||||
peerCertificate = Certificate.peerFromTransport(self.transport)
|
||||
print(peerCertificate.getSubject().commonName.decode('utf-8'))
|
||||
self.transport.loseConnection()
|
||||
|
||||
def main(reactor):
|
||||
pemBytes = FilePath(b"ca-private-cert.pem").getContent()
|
||||
certificateAuthority = Certificate.loadPEM(pemBytes)
|
||||
myCertificate = PrivateCertificate.loadPEM(pemBytes)
|
||||
serverEndpoint = SSL4ServerEndpoint(
|
||||
reactor, 4321, myCertificate.options(certificateAuthority)
|
||||
)
|
||||
serverEndpoint.listen(Factory.forProtocol(ReportWhichClient))
|
||||
return Deferred()
|
||||
|
||||
react(main, [])
|
Loading…
Reference in New Issue