tlsfuzzer / tlslite-ng

TLS implementation in pure python, focused on interoperability testing
Other
234 stars 80 forks source link

tlslite with tornado #381

Open hamdell opened 4 years ago

hamdell commented 4 years ago

Hi,I want to wirte httpserver,can tlslite with torado?

tomato42 commented 4 years ago

I'm not familiar with torado, and don't see anything in the code referencing it, so I'd say that the answer as of now is "no".

That being said, it shouldn't be too hard, there already are integrations with few other modules, see the tlslite/integration directory, e.g.: https://github.com/tomato42/tlslite-ng/blob/master/tlslite/integration/httptlsconnection.py

hamdell commented 4 years ago

@tomato42 ,Thank you for your reply. That's not what I want. I want a highly concurrent and asynchronous HTTP server to get SSL clienthello sent by the browser and respond to the browser in the form of HTTP-JSON. Can you write it?

tomato42 commented 4 years ago

I want a highly concurrent and asynchronous [...] server

while this library does support asynchronous operation, it's definitely not fast

HTTP server to [...] respond to the browser in the form of HTTP-JSON

once you establish a TLS connection you can exchange anything you want on top of it...

Can you write it?

no, that's not why I'm working on this library

hamdell commented 4 years ago

@tomato42 ,thanks,a highly concurrent httpserver to get SSL clienthello sent by the browser is very important to me,the sooner the better,i hope it!

hamdell commented 4 years ago

@tomato42 ,I'm very sorry. I misspelled it. It's tornado, a python's high concurrency asynchronous web framework. I saw / scripts / tls.py. So, can tornado replace basehttpserver?

tomato42 commented 4 years ago

So, can tornado replace basehttpserver?

I'd be surprised if it couldn't. If somebody proposes necessary changes to integrate tlslite-ng with tornado, I will review them, but I won't work on them myself.

hamdell commented 4 years ago

@tomato42 ,Yes,thank you for your reply. Do you have time to call tornado to write an httpserver script similar to tls.py as soon as possible? It's very important to me, thank you very much!

HMaker commented 2 years ago

All good async frameworks integrates well with standard python SSL APIs, one way to integrate is to reimplement the SSL APIs tornado uses using TLSLite as base.

Another way to integrate is through non-blocking sockets, TLSLite supports it, its async functions (named with async suffix) are generators which yields 0 when it wants a readable socket and 1 for writable socket, most async event loops has low level APIs which allows you to set callbacks for when sockets become readable or writable, use it to resume TLSLite generators.