bash - How to use Popen with openssl in Python 3.x -


i porting code python 2 python 3 , realized m2crypto module not ported, yet. unfortunately want s/mime signing , thought use subproccess.popen instead. want give unsigned plist openssl , s/mime signed. in automx (see https://github.com/sys4/automx)

what want is:

bash-example:

echo "test " | openssl smime -sign -signer server.crt -inkey server.key -nodetach -outform der 

i tried in python:

import subprocess s  cmd = "/usr/bin/openssl smime -sign -signer " + sign_cert +\       "-inkey " + sign_key + "-nodetach -outform der" process = s.popen(     cmd.split(),     stdin=s.pipe,     stdout=s.pipe,     stderr=s.pipe,     shell=true)  plist_signed, errors = process.communicate(     input=plist_unsigned)  if errors not none:     logging.error("call openssl failed: %s", str(errors))     return plist_unsigned 

unfortunately doe not work. openssl seems interpred stdin stuff command.


Comments

Popular posts from this blog

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -