Using SSL socket as stdin for subprocess.Popen

dieter dieter at handshake.de
Tue Mar 22 04:22:11 EDT 2016


Matt Ruffalo <matt.ruffalo at gmail.com> writes:
> ...
> I've been using SSL for the communication between the client and server,
> ...
> I've hit an issue that I'm not sure how to work through, though. I'm
> attempting to use a SSL socket (and/or the result of its 'makefile'
> method) directly as the `stdin` argument to subprocess.Popen, but it
> seems that the *encrypted* data is used by the subprocess.

In order to access an SSL socket, something special must be done
during the connection(/opening) phase: then certificates are
exchanged/verified and a common session key is created (used
to encrypt the exchanged data). Only after this special handling
it the SSL socket transparent.

Your observation indicates that your socket is not opened
in this special SSL way - thus, you get the raw data.

Likely, you must make sure that proper SSL initialization has taken
place before you hand the socket down as "stdin" to your "subprocess.Popen".




More information about the Python-list mailing list