I'm having a lot of trouble passing a string to the openssl commandline tool via python's subprocess like this:
process = subprocess.Popen(
["openssl", "rsa", "-in", pathFile, "-out", "id_rsa.out"],
stdin = subprocess.PIPE,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE,
shell=False
)
try:
process.communicate("some passphrase\n", timeout=2)
except:
process.kill() #openssl stays alive otherwise.
The code above times out (with and without the std redirection in the Popen). I can use openssl normally through the terminal just fine, but I really need to be able to run this as part of my python script.
Any help would be appreciated.