Galu32
Galu32

Reputation: 11

How can i sign file with Python?

I need replicate this OpenSSL command in python code, how can i do it?

openssl cms -sign -in FILE..XML -out FILE2.XML -signer CERT.crt -inkey PKEY.key -nodetach -outform PEM

Thank you!

Upvotes: 1

Views: 133

Answers (1)

Yoav Godelnik
Yoav Godelnik

Reputation: 71

Look at the subprocess module in the standard library:

import subprocess
subprocess.run(["ls", "-l"])

Try to have the make a list containing the command, the flags, and the desired flag values, and send this list as an argument to subprocess.run().

You can get than receive the status code and the output as the function's return value.

Upvotes: 1

Related Questions