I have a file to be signed by following command:
$ openssl sha256 -sign privatekey.pem myfile.txt > right.result
Is there any equivalent command to get the same result? I have tried the following method (calculate the sha256 digest firstly, then sign the digest). But it can not work:
$ openssl sha256 -binary myfile.txt > my.digest
$ openssl rsautl -sign -inkey privatekey.pem -in my.digest > wrong.result
The content of "wrong.result" is always different from "right.result". Could someone tell me the reason? Thank you very much!