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
Post a Comment