Im doing ECDSA signatures using dgst
command with OpenSSL as follows:
openssl dgst -sha256 -sign key.pem -out my_signature data_file
which works just fine. However I read in this SO answer that it first SHA256 hashes the data_file, and ASN.1 encodes the hash before signing it.
I would like to create the SHA256 hash of the data and make ECDSA sign just the raw bytes of this hash. (As this is the ECDSA signature, I cannot use rsautl
as in the mentioned SO answer.)
How do I achieve this using OpenSSL?