Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #92330 > unrolled thread

Using ssl module over custom sockets

Started byjbauer.usenet@gmail.com
First post2015-06-08 00:22 -0700
Last post2015-06-08 17:25 +0200
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Using ssl module over custom sockets jbauer.usenet@gmail.com - 2015-06-08 00:22 -0700
    Re: Using ssl module over custom sockets Johannes Bauer <dfnsonfsduifb@gmx.de> - 2015-06-08 17:25 +0200

#92330 — Using ssl module over custom sockets

Fromjbauer.usenet@gmail.com
Date2015-06-08 00:22 -0700
SubjectUsing ssl module over custom sockets
Message-ID<9d27cf3f-3edc-4ff0-ba69-0fc588e049a6@googlegroups.com>
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

[toc] | [next] | [standalone]


#92339

FromJohannes Bauer <dfnsonfsduifb@gmx.de>
Date2015-06-08 17:25 +0200
Message-ID<ml4c4o$p3k$1@news.albasani.net>
In reply to#92330
On 08.06.2015 09:22, jbauer.usenet@gmail.com wrote:

> 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.

Didn't actually have to do that. My solution now is to use
socket.socketpair() and forward traffic from there. Works reasonably
well and isn't racy (unlike opening up a local TCP/IP port would be).

So I think this solves the problem (although it'd still be cool to have
an alternative way of specifying a send/recv function IMHO).

Cheers,
Johannes


-- 
>> Wo hattest Du das Beben nochmal GENAU vorhergesagt?
> Zumindest nicht öffentlich!
Ah, der neueste und bis heute genialste Streich unsere großen
Kosmologen: Die Geheim-Vorhersage.
 - Karl Kaos über Rüdiger Thomas in dsa <hidbv3$om2$1@speranza.aioe.org>

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web