Using ssl module over custom sockets

jbauer.usenet at gmail.com jbauer.usenet at gmail.com
Mon Jun 8 03:22:49 EDT 2015


Hi group,

is it possible to use the ssl module using a custom transport? It appears to me as if currently the relationship between ssl.SSLSocket() and socket.socket() is pretty entangled.

Suppose I do have some kind of reliable transport (let's say RS232) and a connection that I have wrapped in a class. The things I can provide are send/recv methods, but nothing specific to UNIX sockets (getsockopt, etc). Could I use the Python ssl module to perform a SSL connection over such a line?

Something that I could always use as a workaround would be to open up a listening port locally in one thread and connection to that local port in a different thread, then forward packets. But that's pretty ugly and I'd like to avoid it.

Any hints appreciated,
Best regards,
Johannes



More information about the Python-list mailing list