I have a command cat hash.bin | openssl pkeyutl -sign -inkey privk.pem
which can get result correctly.
Now I want to do it with python subprocess
, I do it like this (where hash
is read from hash.bin)
cmd = ['openssl', 'pkeyutl', '-sign', '-inkey ', prvk]
p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=STDOUT)
out = p.communicate(input=hash)[0]
print(out)
But openssl failed.
I can't use -in
and -out
because my code can't access to hard drive..